Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A British man who allegedly tried to grab a police officer’s gun in a plan to kill Donald Trump at a Las Vegas rally last month pleaded not guilty on Wednesday to the charges against him.

Michael Sandford, 20, was ordered to remain held in federal custody, the prosecutor's office said. Sanford has been indicted on two counts of being an illegal alien in possession of a firearm and one count of impeding and disrupting the orderly conduct of government business and official functions.

Sandford was ordered detained until trial, which is scheduled for August 21, the U.S. Attorney’s Office for the District of Nevada said. Each of the three charges carries up to 10 years in prison, the U.S. attorney’s office has said.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Sandford on June 18 allegedly tried to grab a gun from a Las Vegas police officer's holster at a Trump rally at the Treasure Island Hotel and Casino, federal prosecutors said.

He never got the weapon and was immediately arrested.

After his arrest, Sandford allegedly told investigators he tried to grab the gun "to shoot and kill Trump," a Secret Service agent wrote in an affidavit. Sandford also said he believed he would be killed by police in the attempt, according to the document.

Prosecutors say Sandford on June 17 went to a gun range learn how to shoot a gun, and practiced with a Glock 9 mm handgun, which is the type of weapon he allegedly tried to grab from the officer.

In this June 18, 2016 photo, police remove Michael Sandford as Republican presidential candidate Donald Trump speaks at the Treasure Island hotel and casino in Las Vegas. John Locher / AP

A judge previously denied to grant Sandford bail. Sandford was in the U.S. under a visa waiver program, but had overstayed his 90-day allowed stay.

A public defender representing Sandford has said that while Sandford hadn’t been diagnosed with a mental illness, he has autism and had previously attempted suicide, The Associated Press reported. A law enforcement official has previously told NBC News that Sandford appeared to have mental problems.

The federal public defender representing Sandford said in an email Wednesday they were still in the process of gathering information and could not comment on the case.