An American Airlines mechanic has been arrested and charged with sabotaging an aircraft's navigation system before a flight in July, forcing the crew to abort takeoff from Miami, authorities said.

An affidavit in federal court filed Thursday said that the mechanic told law enforcement he was upset about stalled contract negotiations with the company and that the "dispute had affected him financially."

Flight 2834 was about to depart for Nassau in the Bahamas on July 17 with 150 people on board, when an error message appeared after the engines were started up. The crew aborted takeoff and returned to the gate. The plane was taken out of service for maintenance, American Airlines said. Passengers deplaned and American provided a different aircraft for the flight.

The mechanic told law enforcement officials he inserted and glued a piece of foam into the inlet of the plane's air data module, which measures the plane's pitch, speed and other information, according to the affidavit.

The mechanic, Abdul-Majeed Marouf Ahmed Alani, has been suspended, the airline said. He is set to appear in court on Friday, according to the U.S. attorney's office in Miami.

The incident was "disturbing and disappointing to all of us," David Seymour, American's senior vice president of integrated operations, told employees Friday. "Fortunately, with appropriate safety protocols and processes, this individual's actions were discovered and mitigated before our aircraft flew. We have been cooperating with authorities in this matter and will continue to do so."

American's corporate security contacted the FBI to report "possible sabotage," the affidavit said. Federal investigators reviewed security camera footage that showed Alani accessing an equipment compartment in the plane for seven minutes, it added.

American returned the plane that aborted takeoff back to service after an inspection.

Alani said "his intention was not to cause harm to the aircraft or its passengers" but to "cause a delay or have the flight cancelled in anticipation of obtaining overtime work," according to the affidavit.

A fellow mechanic found a loose pitot tube, which connects to the aircraft data module, according to the affidavit. The tube turned out to have been blocked by the foam, federal investigators said.

American and its mechanics have been locked in a bitter dispute over contract talks this year. The airline has accused the unions that represent its some 12,000 mechanics of purposefully disrupting operations by forcing aircraft out of service in order to gain leverage in negotiations. A federal court in Texas last month issued a permanent injunction against the unions for the alleged slowdown.

American has said the unions' actions have forced it to cancel or delay hundreds of flights, adding to operational challenges stemming from the worldwide grounding of the Boeing 737 Max. The unions have denied the allegations.

"From a union standpoint we wouldn't condone even the thought of doing this," said Gary Peterson, a vice president at the Transport Workers Union, one of the unions that represents American's mechanics.

Contract talks between the unions and American are set to resume Sept. 16.

American's Seymour said there are fewer aircraft out of service since the middle of the summer, helping improve operations.