A British man who seized a Las Vegas police officer’s gun in June at a Donald Trump rally pleaded guilty Tuesday in federal court to two felonies.

Michael Steven Sandford, 20, was visibly shaking as he stood before the judge and pleaded guilty to one count 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.

A second count of the firearm charge was dropped as part of the plea bargain.

“It is fortunate that no one was harmed in this incident,” Daniel Bogden, the U.S. attorney for Nevada, said in a statement Tuesday. “The Las Vegas Metropolitan Police Department officer’s attentiveness and quick action prevented the escalation of this crime. The result was that no one was injured.”

Sentencing is scheduled for Dec. 13. Prosecutors have recommended a prison term of between 1½ and 2 years.

When U.S. District Judge James Mahan asked Sandford on Tuesday if he had recently taken any medications, the defendant said he was taking mental health drugs, including a medication used to treat bipolar disorders.

His mother, Lynne Sandford, who lives outside London, told the Reuters news service in August that her son had been diagnosed in the past with autism, depression and other mental health conditions and had been on suicide watch while in custody.

She received a court order in August that allowed her to have a face-to-face visit with her son.

In his 14-page plea agreement, Sandford acknowledged that he faces deportation as well as prison time. His tourist visa expired Aug. 30, 2015.

Sandford was arrested June 18 at Treasure Island, the site of the Trump rally, after he tried to grab the police officer’s gun in an attempt to shoot the Republican presidential candidate.

At the time, he was living out of his car with his expired visa and allegedly told authorities that he drove from California to kill Trump.

According to court records, he went to a gun range on June 17 in Las Vegas and took shooting lessons using a rented handgun.

The following day, he approached the uniformed police officer and asked to obtain Trump’s autograph. When the officer replied, Sandford seized the officer’s gun with both hands and attempted to pull it from the holster.