A man from Uzbekistan living illegally in the United States pleaded guilty on Friday to terrorism and weapons charges involving a plot to kill US President Barack Obama.According to court evidence, defendant Ulugbek Kodirov believed he was acting on behalf of an Islamist militant group in his homeland and was plotting to shoot Obama while the president campaigned for re-election this year. Kodirov 22, pleaded guilty in US District Court in Birmingham, Alabama, to three charges as part of an agreement that spares him from a potential life sentence.He still faced up to 30 years in prison and $750,000 in fines for providing material support for terrorist activity, being an illegal alien in possession of a firearm and threatening to assassinate the president.Four other charges against him were dropped, and mainly involved additional threats to kill Obama.US District Judge Abdul Kallon set sentencing for May 17.Kodirov came to the United States in 2009 to study medicine and his student visa was revoked in April 2010 after he failed to enroll in school, investigators said.He "self-radicalized" through Internet research and sought like-minded individuals, US Attorney Joyce White Vance said.Kodirov was arrested in July at an Alabama motel where he had obtained a fully automatic machine gun and four hand grenades from an undercover agent. "He was attempting to obtain weapons and explosives that he intended to use to kill the President of the United States," Vance said.According to his plea agreement, Kodirov also showed jihadist Web sites and videos on his computer to another individual and told that person he wanted to assist others in jihad overseas. He also had lengthy conversations with another person about killing Obama, and that person introduced him to the undercover agent.Vance said members of the local Muslim community were instrumental in thwarting the threat to the president, but did not give specifics. "We have warm relations with the Muslim community - they also want a safe place to live and raise their children," said Vance.