A Louisiana man fleeing police during a traffic stop faced an alligator on Sunday before continuing to run from authorities. He was, eventually, arrested, according to local officials.

Troopers with the Louisiana State Police stopped Victor Rivas, 40, while he was driving on Interstate 310. Mr. Rivas showed “signs of impairment,” state police said on Monday in a release on social media.

Then, Mr. Rivas fled on foot into a nearby swamp.

That triggered a search for Mr. Rivas, who authorities said fled again into another swampy area after he was spotted walking on another highway.

Soon, Mr. Rivas had a different problem. He was attacked by an alligator, the authorities said.

“An alligator joined the law enforcement team and tried to convince Rivas that surrendering was the better option,” the St. Charles Parish Sheriff’s Office said on Monday in a release on social media.

Body-camera footage released by the Sheriff’s Office appeared to show a hand pointing a gun at splashes in a grassy stretch of water.

Victor Rivas.Credit…St. Charles Parish Sheriff’s Office

Even after his encounter with the alligator, Mr. Rivas continued to run, according to the sheriff’s office. A drone team eventually located Mr. Rivas, and deputies took him into custody as he was leaving the swamp. He was treated at a hospital for non-life-threatening injuries, and booked on Sunday at a correctional center on charges of operating a vehicle while impaired and resisting an officer.

Mr. Rivas could not be reached for comment, and it was not known on Tuesday who was legally representing him.

Louisiana is home to one of the largest alligator populations in the world, with the animals found both in the wild and on farms. In the last 50 years, hunting restrictions have helped to increase the wild alligator population from 100,000 to more than three million, according to the Louisiana Department of Wildlife and Fisheries.

The St. Charles Parish Sheriff’s Office appeared to adopt this particular alligator as an honorary member its team. “The alligator was not injured and has since returned to its regular patrol of the swamp,” the office said. It shared a photo, possibly A.I.-generated, of an alligator, “Al E. Gator,” dressed in uniform being presented with an award for outstanding service and dedication.

But the office also issued a clear reminder for the public: “Don’t drive impaired, don’t run from deputies, and definitely don’t hide in Louisiana swamps.”