A Missouri man who pulled an emergency brake and prompted panic aboard an Amtrak train in southern Nebraska was sentenced Friday to 14 years in federal prison.

Taylor Michael Wilson, 26, of St. Charles, Missouri, was sentenced in a Lincoln federal court, the Lincoln Journal Star reported.

Wilson pleaded guilty in July to a single terrorism count and a weapons count after investigators found a cache of guns hidden in his Missouri home. In exchange, other counts were dropped.

Prosecutors said Wilson was armed with a handgun, ammunition, knife and hammer when he pulled the brake and cut lights to the train in a secure area of the Chicago-bound locomotive on Oct. 21, 2017, after getting into an argument with a black passenger. The train was traveling from California.

According to court records, Wilson hurled racial slurs at conductors who stopped and held him until law enforcement could arrive. An investigator testified that when asked why he stopped the train, Wilson replied that he was “going to save the train from the black people.”

Wilson maintained he was high on drugs at the time and had no terroristic intensions.

“I never had the intention of hurting anyone,” he said at his sentencing, according to the Lincoln Journal Star. “I did not have any hate or ill-will toward anyone on the train.”

But prosecutors argued he’s a danger to society, noting Wilson’s membership in a white supremacist group and his participation last year in a white nationalist torch-lit march and rally in Charlottesville, Virginia.

District Judge John Gerrard agreed, saying as he issued the sentence that Wilson was “a gun-toting, angry ... white supremacist” and that it was fortunate for the train’s 175 passengers that Wilson was caught in the act of disabling the train.