A man arrested at a Donald Trump rally in Las Vegas over the weekend told authorities he tried to grab an officer's gun so he could kill the candidate, according to court documents released Monday.

The documents also showed that the suspect was in the United States illegally. He had overstayed his visa from the United Kingdom, KLAS reported.

A complaint filed in U.S. District Court in Nevada charges Michael Steven Sandford, 19, with an act of violence on restricted grounds. A judge denied him bail at a court hearing Monday.

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 court document says that Sandford was arrested after grabbing the handle of an officer's gun in an attempt to remove it.

When Sandford was asked by a Special Agent why he attempted to grab the officer's gun, he replied "to shoot and kill Trump." 

If he failed, Sandford stated he booked tickets for a Trump rally in Phoenix and would try to kill Trump there. He added that he had been planning to attempt to kill Trump for about a year, but decided he would act on this occasion because he finally felt confident about trying it.

The 19-year-old said in the court documents released Monday that if he were on the street tomorrow, he would try this[killing Trump] again. 

Sandford had a United Kingdom driver's license with him at the time, according to the criminal complaint signed by Secret Service Special Agent Joseph Hall.

Secret Service agents said that Sandford told them he had been in the U.S. for about a year and a half, lived in Hoboken, N.J., and drove to the San Bernardino, Calif., area before coming to Las Vegas on June 16.

Sandford also 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.

About 1,500 people attended the Las Vegas 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.

The Associated Press contributed to this report.