Gregory Lee Leingang had stolen an abandoned forklift to attempt to flip Donald Trump's limo.

Last fall, President Donald Trump flew to Mandan, North Dakota, to give a speech at the largest oil refinery in the state. His brief visit made a few minor headlines: In a rare show of bipartisanship, Trump had joined Heidi Heitkamp, then the state's Democratic junior senator, to tout his tax overhaul plan. (She would later oppose the bill.)

And once at the Mandan Refinery, Trump had spontaneously invited his eldest daughter, White House adviser Ivanka Trump, onto the stage, telling the crowd that she had asked, "Daddy, can I go with you?"

Last week, it was revealed that the trip was noteworthy for another reason: A North Dakota man had been arrested at the refinery on the day of Trump's visit, reportedly over a plan to assassinate the president - using a stolen forklift.

Gregory Lee Leingang, 42, was charged last fall with attempting to enter or remain in the refinery on Sept. 6, 2017, the day of Trump's visit, as well as one count of attempting to damage government property. He pleaded guilty on Friday to the first count.

According to a copy of the plea agreement, Leingang knowingly entered and remained in a restricted area, "that is, the Mandan Refinery and its grounds and presidential motorcade route . . . and in relation to the offense, did use a deadly and dangerous weapon, that is, a forklift."

"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," U.S. Assistant State's Attorney Brandi Sasse Russell said, according to the Grand Forks Herald.

However, Leingang's strange plan went awry after he abandoned the forklift and was caught by police as he tried to run away, authorities said. He later admitted to police that he wanted to use the forklift to kill Trump.

The arrest capped off a string of crimes Leingang committed in the region that day, according to Mandan Deputy Police Chief Lori Flaten.

Earlier that morning, Leingang had set two fires in Bismarck, on the other side of the Missouri River, and had stolen a truck from the city's Parks and Recreation Department, Flaten said.

Leingang later abandoned the truck, then crossed the river over to Mandan and made his way to a sports complex under construction near the Mandan oil refinery - "which is where he got the forklift," Flaten said.

"He got around that day," Flaten told The Washington Post.

Though other news outlets reported that Leingang got the stolen forklift stuck in a "gated area," Flaten said he never made it that far into the refinery. Leingang dumped the forklift in a ditch and took off on foot afterward, she said, which is when authorities apprehended him.

"We had that whole area blocked off because of the president's visit, so there was limited access," Flaten said. "It wasn't until later, during interviews of him, that we found out that was his intention [to kill the president], not that he was stealing a forklift for transportation."

Leingang pleaded guilty on Friday to one count of "attempting to enter or remain in a restricted building and on grounds while using a dangerous weapon," according to court records. He is scheduled to be sentenced Feb. 15, 2019.

Public defender Michelle Ann Monteiro told the court that Leingang was "suffering a serious psychiatric crisis" during the forklift incident and has been responding well to psychiatric treatment and therapy in prison, according to the Bismarck Tribune.

Leingang also pleaded guilty to setting the two fires in Bismarck and to stealing the forklift, as well as to a separate burglary, and was sentenced to 20 years in prison for those crimes, the newspaper reported.

Monteiro did not immediately respond to a request for comment Monday morning.

In June 2016, a British man allegedly tried to steal a police officer's gun to kill Trump - then a candidate in the Republican presidential primary - at a rally in Las Vegas.