A horse videotaped galloping on the loose on highways near JFK Airport on Sunday night was brought to safety by fast-acting Port Authority police, the agency and its lieutenants union said.

Video posted on social media shows the animal running on an exit ramp for the airport, past motels and parking lots. Port Authority officials said officers who responded to a report about a runaway horse on the JFK Expressway around 6:30 p.m. determined the horse had traveled across airport property before running south on the Van Wyck Expressway.

Police “safely contained and captured the horse” at the entrance to JFK’s Terminal 1, officials said. The animal was uninjured and was returned to the equestrian Curly’s Cowboy Center in Southeast Queens, less than a mile from the airport, according to the Port Authority and center owner R.W. “Curly” Hall. Traffic impacts to the terminal concluded by around 8 p.m., authorities said.

Hall said the center was feeding horses and cleaning out stalls after a holiday event when the horse, Sundance, “took off” through a small gap in a gate that was left ajar during a car-and-trailer maneuver.

“It was just a mishap,” Hall said. “That's all.”

He said the horse isn’t his, but its owner was on the scene Sunday night.

The Port Authority Police Lieutenants Benevolent Association union wrote in a post on Instagram that a lieutenant was able to stop the horse thanks to the lieutenant's “quick thinking and calm control.”

“Unexpected calls demand steady leadership,” the union wrote. “This is what leadership looks like in real time.”

This story has been updated with additional information.