Washington ( CNN ) -- A man from Uzbekistan living in Alabama was sentenced Friday to almost 16 years in prison for threatening to kill President Barack Obama . Ulugbek Kodirov , 22 , pleaded guilty in February to threatening Obama , providing material support for terrorism and for illegally possessing an automatic weapon . In his guilty plea , Kodirov said that in 2011 he was communicating with a person he thought was a member of the Islamic Movement of Uzbekistan , a designated terrorist group , and that `` Kodirov interpreted these conversations to mean that he should kill President Obama , '' according to the Justice Department . Kodirov also admitted speaking to a different person in July 2011 about wanting to kill Obama and possible ways to carry out the act . Kodirov did not realize that person was a confidential source for law enforcement who then introduced Kodirov to someone to help him get weapons . The new contact was actually an undercover agent . The three men met in a motel room in Leeds , Alabama , on July 13 , 2011 , and the undercover agent showed Kodirov a machine gun , a sniper rifle with a telescopic sight and four disassembled hand grenades , and asked if he would like any of them to `` carry out his plan to kill the President . '' Kodirov picked the machine gun and the hand grenades , according to the Justice Department . Kodirov took the weapons and left the meeting but was arrested by agents before he could get out of the building . Kodirov came to the United States on a student visa in June 2009 , but failed to enroll in school . His visa was revoked in April 2010 and from then on he was in the country illegally .
Ulugbek ##ov plotted to kill the president , the Justice Department said . He pleaded guilty in February to the charges . He came to the US in 2009 on a student visa , but failed to enroll in school .