The U.S. Border Patrol and first responders in southern Arizona rescued a Mexican man who was found stuck inside a drainage pipe near the U.S.-Mexico border Tuesday after he tried to hide from law enforcement, according to U.S. Customs and Border Protection.

The Department of Homeland Security agency said the man was pulled to safety with little time to spare before he would have drowned in the water and mud flowing through the rising drain.

A witness reported seeing a group of "possible illegal aliens" near Gila Bend, a town of 2,000 people about 40 miles southwest of Phoenix, though CBP did not share in its news release why the caller found the group suspicious.

CBP sent an Air and Marine Operations crew to the scene and officers watched a man climbing into a culvert drainage pipe. This type of pipe is most often used as ditch relief for water to pass under a road. The flight crew then reached out to local agents at Border Patrol's Ajo Station for on-ground support.

Agents arrived on the scene and helped keep the man's head above water until Gila Bend Fire and Rescue showed up. First responders were able to pull the man out of the pipe. He was taken to a local hospital and treated for injuries that were not life-threatening.

CBP said the 36-year-old Mexican citizen had recently entered the country illegally. After he is released from the hospital, he will be turned over to U.S. Immigration and Customs Enforcement for deportation.