Two workers were freed Thursday evening after being trapped in a 15- to 20-foot-deep trench in Potomac for nearly three hours after a wall collapsed on them, a Montgomery County Fire and Rescue Service spokesman said.

The two men’s medical conditions were being evaluated by EMS workers around 8:15 p.m., spokesman Pete Piringer wrote in a tweet.

Earlier, Piringer described the workers as being conscious, breathing and trapped in wet mud that reached up to their torsos. And he noted then that the men were potentially at risk of compression injuries, which can cause organs to shut down and can cause damage to the body’s extremities.

A team from the University of Maryland Shock Trauma Center in Baltimore flew to the site of the accident by helicopter to be ready to attend to the men.

Fifty to 60 rescue workers were involved in the effort, which required securing the deep trench to make it safe for rescuers as well as digging the men out.

The incident occurred at a house in the 10900 block of Martingale Court, Piringer said. The two men, along with two more crew members, had been working on a project that involved accessing the foundation of a large house. Rescue crews set up lights to prepare to work into the night if necessary, Piringer said.

“It’s painstakingly slow,” Piringer said, though he noted that crews were carrying out the difficult task as quickly as possible. “It’s very labor-intensive.”