A California mechanic who worked for American Airlines for more than 30 years has pleaded guilty to tampering with an aircraft in a deal to avoid a maximum sentence of 20 years in prison, according to reports.

Abdul-Majeed Marouf Ahmed Alani, 60, admitted using a piece of foam to sabotage the plane's air module system -- which reports aircraft speed, pitch, and other flight data to pilots -- on a July 17 flight from Miami to the Bahamas with 150 passengers aboard the aircraft.

“I do admit the guilt,” he said through an Arabic interpreter in Miami federal court Wednesday, according to the Miami Herald.

FRONTIER AIRLINES ACCUSED OF MISHANDLING SEXUAL ASSAULT ALLEGATIONS IN NEW LAWSUIT

Alani -- who lived in California, but commuted to Miami International Airport -- told prosecutors he didn't want to harm any passengers when he tampered with the navigation system, but when asked if he would take his own family on a jet without one, he replied "No."

None of the 150 passengers on the plane was injured from his attempted sabotage because the plane never left the ground, authorities said.

An error alert appeared as pilots were powering up the aircraft, which caused the flight to be aborted and taken out of service for routine maintenance, according to the outlet. Passengers were subsequently moved to another plane.

Alani told federal investigators he disabled the system that morning because he was upset about how union contract negotiations with the airline had stalled. He said he wanted to make additional overtime for maintenance on the plane, the Herald reported.

During a detention hearing in September, federal prosecutors said Alani displayed support for ISIS by making statements about wishing Allah would use "divine powers" to harm non-Muslims while sharing ISIS videos on his cellphone.

Alani also reportedly told arresting agents he had an "evil side." He was not charged with any terrorism-related offense, according to the outlet.

AIRPLANE PASSENGER TAPED TO SEAT AFTER TRYING TO STORM COCKPIT, ACTING LIKE 'WILD BEAR'

“He made a terrible mistake,” his attorney, Jonathan S. Meltz said Wednesday, according to the Wall Street Journal. “Terrible, terrible lapse in judgment, but it does not make him a terrible man.”

American Airlines also issued a statement following Alani's plea deal.

CLICK HERE TO GET THE FOX NEWS APP

“We are grateful for the work of the FBI, the U.S. Attorney’s Office and other officials in resolving this matter," the statement read. “American Airlines has fully cooperated throughout the investigation. After we learned about the allegations, we inspected aircraft that Mr. Alani had worked on to ensure that they were safe.”

Alani faces up to three years in prison. His sentencing is set for March 4.