NEW MARKET, Md. (WJZ) — Racing the clock. Rescue workers in Frederick County worked to save a man trapped in a trench as the water rose around him.

Meghan McCorkell has the daring rescue.

That man was working on a municipal water main when it burst, trapping him in the trench.

Water and mud rose around the trapped construction worker.

“It was a pretty dangerous situation. He was up to here,” said neighbor Dan Batt.

Rescue officials say the 49-year-old man was working on a municipal water main near Eaglehead Drive in New Market when a pipe burst just after 3 p.m.

“That caused some of the debris around the sides and the water to start to cave in on him,” said Frederick County Fire Chief Denise Pouget.

Water was cut off to the area as heavy equipment was brought in to shore up the trench, a tedious process. Then firefighters could work to free the man’s legs.

Teams from both Montgomery and Howard counties were called out to assist Frederick County firefighters with the rescue.

“There was a lot of rescue crews, I guess from all over, from Howard County, Montgomery County and Frederick County. They just kept coming and coming,” Batt said.

WJZ was there more than three hours later as emergency crews finally freed the man. The fire chief said the man was exhausted, but remained stable the entire time as he was loaded into an ambulance.

The man is from Pennsylvania and was taken to Shock Trauma for treatment.

The fire chief credits the responders that first arrived on the scene for their quick thinking in saving that man’s life.