A North Dakota man accused of plotting to use a forklift to flip over President Trump's limo to "kill the president" pleaded guilty on Friday.

Gregory Lee Leingang, 42, was charged in federal court regarding his plan that revolved around Trump's visit to Mandan, North Dakota, in September 2017, the Grand Forks Herald reported.

WISCONSIN MAN WHO PENNED ANTI-TRUMP MANIFESTO, STOLE GUNS, IS SENTENCED TO PRISON

Trump was visiting the city, roughly 6 miles west of Bismarck, to give a speech on tax reform.

Leingang, according to U.S. Assistant State's Attorney Brandi Sasse Russell, stole a forklift and entered Trump's motorcade route after the president arrived in the city one afternoon.

"The intent was to basically try to get to the limo, flip the limo and get to the president and he wanted to kill the president," she said of Leingang.

U.S. President Donald Trump addresses a tax reform event with workers at the Andeavor Refinery in Mandan, North Dakota on Sept. 6, 2017. (REUTERS/Jonathan Ernst)

Leingang tried to escape after the forklift got stuck in a gated area, according to reports. He was caught by local police and allegedly confessed his plan to authorities, including the U.S. Secret Service.

A public defender argued in court that Leingang was "suffering a serious psychiatric crisis during this incident," and reportedly set two fires earlier on the same day he stole the machinery.

Leingang was charged with one count of attempting to enter or remain in a restricted building and on grounds while using a dangerous weapon and one count of attempting to damage government property.

COHEN DEAL SIGNALS MUELLER PROBE'S INTENSIFYING FOCUS ON TRUMP: 'IN SEARCH OF A CRIME?'

He entered a plea deal with federal prosecutors and was sentenced to five years in prison for stealing the forklift. He's also serving time for pleading guilty to starting the fires and for a burglary case, and is expected to remain behind bars for decades.

A sentencing hearing for Leingang is scheduled for Feb. 15.