The American Airlines mechanic who disabled a key navigation system on a jetliner leaving Miami — saying he did it over a labor dispute — had grisly ISIS propaganda videos on his cellphone, federal prosecutors said in court on Wednesday.

Prosecutor Maria Medetis said that when investigators grilled the mechanic, Abdul-Majeed Marouf Ahmed Alani, after his arrest on Sept. 5, he told them he had an “evil side” and that he “wanted to do something to delay” the plane, which had 150 people onboard, the Miami Herald reported.

But a co-worker told investigators that Alani had once said his brother was a member of ISIS, and that he traveled to Iraq in March to visit him.

Prosecutors said authorities also discovered a November 2018 article that had been sent to him about one of the Boeing 737 Max 8 crashes, and that the article described issues with the plane’s navigation system.

“What you did was at minimum highly reckless. It was unconscionable,” federal Magistrate Judge Chris McAliley told Alani in court Wednesday.

Authorities also said at least one of the ISIS videos was downloaded on Alani’s phone and sent to another person with a message that called for Allah to “use all your might and power against the Kafir,” or non-believers of Islam.

A native Iraqi who is now a US citizen, Alani, 60, was not charged with a terror-related crime. He was denied bond during the proceeding, where the feds said photos on his phone from a trip to Baghdad and Mosul showed him smiling and posing with relatives.

He was charged with “willfully damaging, destroying or disabling an aircraft.” His arraignment is Friday, and he faces up to 20 years in prison on the sabotage charge.

Alani initially said that he sabotaged the Boeing 737 at Miami International Airport because labor negotiations were hurting his chances to snare overtime.

A criminal complaint said Alani admitted to sabotaging the airplane July 17 as it was scheduled to fly from Miami to Nassau, Bahamas.

He was accused of gluing foam inside a tube leading from outside the plane to its air data module, which reports the speed, pitch and other critical data.

If the plane had taken off, the pilots would have had to fly manually because the system would not have received computer data.

The sabotage was discovered when another mechanic inspected the plane at the airline’s hangar and found a loosely connected tube in front of the nose gear that had been deliberately obstructed.

Alani added that he only tampered with the ADM “to cause a delay or have the flight canceled in anticipation of obtaining overtime work,” the affidavit said.

Authorities zeroed in on Alani – who has worked for the airline since September 1988 – after reviewing surveillance video that captured him getting out of a truck, approaching the plane and accessing a compartment where the navigational equipment is located, the affidavit said.

The air marshals also interviewed three other airline mechanics — who were with Alani after his alleged tampering – and they helped investigators identify him from the video.

Alani lives in Tracy, California, but regularly commutes to Miami to work as an American mechanic, the paper reported.