A man trying to flee the country to escape his trial escaped from the feds Tuesday at Newark Liberty International Airport and hid in the ceiling before cops nabbed him, law enforcement officials said.

The indicted man — whose name was not released — had been stopped at the airport by U.S. Customs and Border Protection for trying to skip out on his New York trial, a spokesman for U.S. Customs and Border Protection said.

The man was taken into federal custody — but tried to escape into the ceiling after asking to use the bathroom in Terminal C, which houses United Airlines, around 11:30 a.m, according to officials.

Cops were able to pull the man from the ceiling around 1:30 p.m. and turn him over to Homeland Security, the officials said.

“The incident resulted in minimal operational impact to Newark Liberty International Airport,” a Port Authority spokeswoman said.