An Uzbek man has pleaded guilty to plotting to kill U.S. President Barack Obama, the New York Daily News reported.

Ulugbek Kodirov has been held without bail since he was arrested at a motel in the U.S. state of Alabama in July last year after buying a machine gun from an undercover federal agent. The 22-year-old entered the plea during a hearing in an Alabama federal court on Friday. The Uzbek’s defense lawyers said he avoided a possible life sentence by pleading guilty and was now facing up to 15 years in jail at the sentencing, due in May.

Kodirov was charged with threatening to kill the president, possessing an automatic weapon, and providing material support to terrorists. Authorities said Kodirov was in the United States illegally after he obtained a student visa in 2009 but never enrolled at school. Prosecutors have said Kodirov made four separate threats against President Obama in the week before his arrest.