The British man who grabbed a police officer's gun at a Donald Trump rally has pleaded guilty to federal charges that could see him jailed for two years in the US.

Michael Steven Sandford pleaded guilty to being an illegal alien in possession of a firearm and disrupting an official function, which could have carried a 20-year sentence if he was convicted at trial.

'I tried to take a gun from a policeman to shoot someone with, and I'm pleading guilty,' Sandford told the judge at the US District Court in Las Vegas.

Scroll down for video

Michael Steven Sandford, who grabbed a police officer's gun at a Donald Trump rally, has pleaded guilty to federal charges that could see him jailed for two years in the US

Sandford, 20, was arrested on June 18 after grabbing for the gun in a 1.500-seat venue at Treasure Island hotel-casino, Las Vegas. He did not get the gun, and no shots were fired before he was arrested.

Sanford entered his pleas after his mother, Lynne Sandford, and a lawyer arrived from London and met with him in custody last week.

Sentencing guidelines call for 18 to 27 months in prison for the offenses, after credit for time served, accepting responsibility for the crime and avoiding trial, which had been set to start October 3. Under the plea deal, Sandford won't be able to appeal.

Family attorney Saimo Chahal said a psychiatrist she enlisted to review the case determined that Sandford was delusional at the time of the attempted attack.

Sandford also suffers seizures, obsession-compulsion, anxiety and autism spectrum disorders, Chahal said.

He added: 'Michael was not in control at the time of the events and needs help. He is desperate to return to the UK to be near his family as he has no ties with the USA.'

Sandford, 20, was arrested on June 18 after grabbing for the gun in a 1.500-seat venue at Treasure Island hotel-casino, Las Vegas (pictured)

His mother, 42. said: 'I gathered it was a formality, because he did indeed sign the plea agreement whilst I was out there.

'So I was advised it would go to court so that the judge could accept it, but that it would be very rare if he didn't.'

She said her son had been 'pondering' over signing a plea agreement for some time.

'The upshot of it is that there is no certainty. Even though he has signed the plea agreement, which should be the best option, it won't necessarily happen that way,' she added.

'The judge at sentencing can either agree with what is in the plea bargain or he can totally overthrow that and impose a punishment of his own.'

Sandford later told a federal agent that he drove from California to Las Vegas with a plan to kill Trump (pictured)

Court documents say Sandford acknowledged asking the police officer at the event if he could get Trump's autograph then lungin for the officer's 9mm handgun with both hands.

It wasn't clear if Trump recognized a threat before officers escorted Sandford out of the auditorium.

Sandford later told a federal agent that he drove from California to Las Vegas with a plan to kill Trump, and that he rented a 9mm pistol and fired 20 shots at a paper target at a Las Vegas gun range the day before, according to court documents.

Sandford told the agent it was the first time he had ever fired a gun.

He also said he expected he would be killed during the assassination attempt, but that if he wasn't, he would make another attempt on Trump's life at a rally in Phoenix, court documents state.

The plea agreement acknowledges Sandford had been in the US illegally for almost 10 months at the time of his arrest.