(CNN) -- A man from Uzbekistan living in Alabama has pleaded guilty to charges related to a plot to assassinate President Barack Obama, prosecutors said Friday.
Ulugbek Kodirov, 21, faces up to 15 years behind bars after he sought help to either shoot the president or kill him with explosives in a suicide attack, according to a government affidavit.
Kodirov pleaded guilty to supporting terrorist activity, threatening to kill the president and illegal possession of an automatic weapon.
Lance Bell, his court-appointed attorney, said Kodirov had initially intended to enter a not guilty plea at his arraignment.
A source whom Kodirov contacted for help with his plot told authorities that Kodirov supports Islamic extremists, the affidavit says.
Authorities say Kodirov stayed in the United States illegally after his student visa was revoked. He was arrested on July 13 at a motel in Leeds, Alabama, after he obtained a machine gun and four disassembled hand grenades from an undercover agent, the Justice Department said.
In an affidavit filed that day with a search warrant request for a room at the extended-stay motel -- Kodirov's apparent home -- U.S. Secret Service Special Agent Todd Matney said Kodirov contacted "an FBI confidential reliable source" on July 9 and 10 and "made inquiry regarding possible ways to kill President Obama, including shooting the president from a long distance," and asked for help.
Not knowing the person he was speaking to was a confidential source for the authorities, "Kodirov specifically provided information ... pertaining to long-range sniper rifles" and also asked about using explosives, saying "that he did not care if he lost his own life killing President Obama," Matney said in the affidavit.
"On or about July 11, Kodirov" told a second confidential source that he wished to kill Obama and asked for help.
The second source "knows Kodirov to be a very strict Muslim, who has previously expressed support for Islamic extremists," the affidavit says. The source knows that "Kodirov views jihadist websites and Internet content" on a laptop in his residence, the affidavit said.
Items to be seized at the residence included computers, mobile phones and documents, the affidavit said.
"There is probable cause to believe" that documents -- including information about "possible co-conspirators," as well as "sniper rifles and other long range weaponry, assault rifles, hand guns, explosives, weapons training and tactic manuals, documentation related to assassinations, Jihadist manuals and training manuals" -- were at the premises, the affidavit said.