New York (CNN) -- A Lufthansa jumbo jet nearly collided with another plane at John F. Kennedy International Airport Monday after an EgyptAir flight apparently veered into its path just as the jet barreled down the runway, according to air traffic controller tapes.

The near miss was captured on audio recordings, revealing an air traffic controller communicating with the Lufthansa pilot, yelling "Cancel takeoff! Cancel takeoff plans!" as the two planes moved toward each other.

The pilot of the Lufthansa jet acknowledged as the plane rolled to a halt.

Lufthansa Flight 411, an Airbus 340 packed with 286 passengers and crew, was cleared for takeoff by air traffic control shortly before 7 p.m. Monday, according to a statement from Federal Aviation Administration spokeswoman Kathleen Bergen.

EgyptAir Flight 986, a Boeing 777, was issued instructions to taxi from the ramp area to the airfield for departure.

The plane was instructed to turn onto another taxiway, but instead went straight, the statement said.

A spokesman for EgyptAir said the flight was delayed 40 minutes because Lufthansa's departure was delayed.

The plane did not move until the tower issued clearance, spokesman Mohamed Rahma said.

After a brief inspection at the gate, the Lufthansa flight continued on its flight to Munich, Germany, and arrived safely, according to Lufthansa spokesman Martin Riecken.

The FAA is currently investigating the incident.

Mohamed Fadel Fahmy contributed to this report.