A former US airline pilot has admitted committing a "lewd, indecent, or obscene act" during a flight last year.
Michael Haak, 60, exposed himself to the female first officer in the cockpit and watched pornography on a laptop, prosecutors said.
As the Southwest Airlines flight continued, Haak engaged in further "inappropriate conduct" in the cockpit.
A judge in Maryland sentenced him to one year's probation and ordered him to pay a $5,000 (£3,500) fine.
The incident happened during a flight from Philadelphia International Airport to Orlando International Airport on 10 August 2020, the court heard.
When the flight reached cruising altitude, Haak got out of the pilot's seat, "intentionally disrobed" and watched pornographic media on a laptop.
"Haak further engaged in inappropriate conduct in the cockpit, as the first officer continued to perform her duties," federal prosecutors said in a statement.
Haak had never met the first officer prior to the flight, they added.
Assistant US Attorney Michael Cunningham said the co-pilot "had a right not to be subjected to this kind of behaviour, regardless of what may have motivated it or prompted it", the Associated Press reported.
Haak was charged in Maryland because it was the state that the plane was flying over at the time. He pleaded guilty to intentionally committing a lewd, indecent or obscene act in a public place.
In a statement via video link, Haak apologised for his behaviour, adding: "It started as a consensual prank between me and the other pilot. I never imagined it would turn into this in a thousand years."
US Magistrate Judge J Mark Coulson told Haak that his behaviour had had a traumatic effect on the first officer and could have affected the safety of passengers.
Haak, of Longwood, Florida, was a pilot with Southwest Airlines for 27 years before retiring at the end of August last year.
In a statement, the airline said it did not tolerate "behaviour of this nature and will take prompt action if such conduct is substantiated". A spokesman said the company had only learned of the incident after Haak had voluntarily left the airline.
It said that, as a result, it had ceased paying him any benefits he was entitled to following his retirement.