TAMPA, Fla. (WFLA) — A LATAM Airlines pilot died Monday on a flight from Florida to Chile, according to the airline.

Flight LA505, a Boeing 787, from Miami to Santiago was diverted to Tocumen International Airport in Panama City, Panama, after one of the pilots had a medical emergency, according to the airline.

The pilot, who had been with the airline for 25 years, died after landing and receiving medical assistance, the airline said in a statement to WFLA.com.

“LATAM Group is deeply saddened by this event and takes this opportunity to express our most sincere condolences to the family of our employee,” the statement reads. “We are thankful for his 25-years of service to LATAM, distinguished by his dedication, professionalism and enthusiasm.”

The airline apologized to passengers for the delay, and said the flight arrived in Santiago at 4 a.m. local time Wednesday.