D.C. United goalkeeper Bill Hamid walks off the field after receiving a red card in the 17th minute. (Bob Levey/Getty Images)

When the halftime whistle pierced the evening air, D.C. United trudged to the locker room down two goals, down a man and down to one substitute.

In a town where United has endured annual humiliation, Sunday’s catastrophe might’ve topped them all.

It began with a penalty kick and a red card to goalkeeper Bill Hamid in the same sequence — and continued to unravel. Another Dynamo goal and an injury to an exposed back line deepened the predicament before intermission and ultimately led to a 4-0 trouncing before 18,871 at BBVA Compass Stadium.

United (10-6-3, 33 points) lost for just the second time in seven matches and failed to keep pace with first-place Sporting Kansas City (11-5-3, 36) in MLS’s Eastern Conference. New York (32), Chicago (31) and Houston (28) made up ground on United over the weekend.

The turning point came when Hamid tripped the free-running Macoumba Kandji in the 17th minute, resulting in a penalty and an ejection that left United short-handed for 70-plus minutes. He will sit out Saturday’s match at Columbus (6-7-4) as well.

“A big apology to my teammates and the fans,” Hamid said. “Maybe I shouldn’t have stuck my leg out there or left my feet.”

Brad Davis converted the penalty against backup keeper Joe Willis. Will Bruin, Boniek Garcia and Brian Ching added goals for the Dynamo (7-5-7), which improved to 8-0-1 with a 18-4 goal advantage at home in all competitions against United.

United began with promise, generating three quality opportunities in the run of play. Chris Pontius, who earlier in the day was named to the MLS all-star team, lacked the usual precision in the box.

From there, it all fell apart.

Hamid upended Kandji, who had latched onto Corey Ashe’s long ball. Hamid said he didn’t think he made any contact, although replays appeared to contradict him. Davis rifled the penalty just beyond Willis’s stretch.

“First look, I had no problem” with referee Jasen Anno’s decision to award the penalty and send off Hamid, Coach Ben Olsen said. “Bill is a young goalkeeper. He’s still going to have these games every now and then where he doesn’t make the right decision.”

United endured ruthless pressure the rest of the half. A soaring Willis touched Davis’s 22-yard blast off the crossbar, Bruin headed at Willis and Kandji’s 17-yarder streaked over the bar.

As United’s defensive effort deteriorated, the assault continued. In the 37th minute, Luiz Camargo beat Brandon McDonald to the end line and crossed past Willis to link with Bruin for a simple one-touch into an open net — his 10th goal of the year.

“After the red card, we didn’t respond quickly enough,” said right back Robbie Russell, who departed in the 40th minute with a foot injury. “We got a little shell-shocked. It wasn’t until the last five minutes of the half that we started to pull ourselves together.”

Olsen was troubled by United’s response after Hamid’s exit. “I thought we could’ve been meaner. I thought we could’ve been angrier,” Olsen said. United needed to “keep the game 1-0 as long as you can. . . . Not everybody was working as hard as they could, so that was alarming.”

United couldn’t hold enough possession in the second half to mount a reply. In the 62nd minute, Houston expanded the lead on Garcia’s eight-yard header, set up by Andre Hainault’s cross.

Willis made a diving save on Calen Carr, who also hit the post in the half. Later, Danny Cruz tripped Carr, resulting in Ching’s 89th-minute penalty kick.

United notes: Defender Emiliano Dudar didn’t travel because of a family emergency in Washington. . . . Houston’s Geoff Cameron, a U.S. national team defender, started despite a possible transfer to English club Stoke City soon. A deal seemed imminent, but MLS turned down the latest offer, reportedly $2 million.