BIRMINGHAM, Ala. (AP) — A man from Uzbekistan has pleaded guilty to terror-related charges in a plot to assassinate President Barack Obama.

Ulugbek Kodirov entered the plea Friday in federal court in Birmingham, Ala. Defense attorney Lance Bell says the 22-year-old man avoided a possible life sentence by pleading guilty. Instead, he now faces about 15 years in prison at sentencing.

Kodirov pleaded guilty to three counts: Threatening to kill the president, possessing an automatic weapon, and providing material support to terrorists.

Kodirov was indicted last July after prosecutors said he bought an automatic rifle from an undercover agent with plans to kill Obama.

Authorities say Kodirov was in the country illegally because he obtained a student visa but never enrolled in school.