LAS VEGAS -- A man arrested at a Donald Trump rally in Las Vegas told authorities he tried to grab an officer's gun so he could kill the candidate, according to federal authorities.

A complaint filed Monday in U.S. District Court in Nevada charges 20-year-old Michael Steven Sandford with an act of violence on restricted grounds.

Federal Magistrate Judge George Foley on Monday declined to grant bail to Sandford. Foley said Sandford was a risk to the community and a flight risk.

Get Breaking News Delivered to Your Inbox

Sandford has not entered a plea.

Authorities said Sandford went to a Trump rally on Saturday at the Treasure Island Casino and approached a Las Vegas police officer to say he wanted an autograph from Trump. The report says Sandford grabbed the handle of an officer's gun in an attempt to remove it, and was arrested.

Public defender Heather Fraley said Sandford appeared to be competent and hadn't been diagnosed with a mental illness but that has autism and previously attempted suicide. He was living out of his car, didn't have a job and was in the country illegally after overstaying a visa.

Sandford had a United Kingdom driver's license with him at the time, according to the complaint. He told a special agent that he was in the U.S. for about a year and a half and lived in Hoboken, New Jersey, then drove to the San Bernardino, California area in his car before coming to Las Vegas on June 16.

Sandford told officers he had been planning an assassination for about a year and was convinced he would die in the attempt. He said he also reserved a ticket for a Trump rally in Phoenix, scheduled for later in the day, as a backup.

He told authorities that he went to the Battlefield Vegas shooting range the day before the rally and fired 20 rounds from a 9mm Glock pistol to learn how to use it. Police detectives who visited the range spoke with an employee who confirmed that he provided Sandford shooting lessons, according to the complaint.

Las Vegas police leads Michael Steven Sandford from Republican U.S. presidential candidate Donald Trump's campaign rally at the Treasure Island Hotel & Casino in Las Vegas, Nevada June 18, 2016. REUTERS

About 1,500 people attended the rally, which was held in the Mystere Theater inside the casino. Attendees had to pass through metal detectors manned by Secret Service, police and casino security officials.

Meanwhile also on Monday, Trump fired his campaign manager Corey Lewandowski, CBS News confirmed.

Trump's spokeswoman Hope Hicks, confirmed the parting of ways in a statement that announced, "Corey Lewandowski will no longer be working with the campaign," adding that the campaign was "grateful to Corey for his hard work and dedication and we wish him the best in the future."

Lewandowski was at home in New Hampshire for Father's Day and flew to New York Monday morning, and he participated in a "daily messaging" conference call with the RNC. Afterward, the Trump campaign held a conference call without him, run by campaign chairman Paul Manafort, to discuss Lewandowski's termination.

A growing chorus of Republican voices, including Trump's children, had called for Lewandowski's ouster. Ivanka Trump urged her father to dump Lewandowski, and it appears her word carried significant weight. There were rumors Lewandowski was planting negative stories about Ivanka's husband, Jared Kushner, who has taken a prominent role in the campaign.

Lewandowski's firing complicates the already-confusing organizational structure of the Trump campaign. His portfolio included communications and media relations, finance, stage management, the road show.

It is unclear who will now take over his responsibilities.