Morning traffic was stopped by police vehicles blocking the intersection of K Street and Connecticut Avenue NW. (Carolyn Kaster/AP)

D.C. police said they arrested a 31-year-old woman who fired a gun and barricaded herself in a downtown Washington office building Monday, igniting a 10-hour standoff that created a mess for morning commuters with road and sidewalk closures in downtown Washington.

The situation began at 12:19 a.m., when police were called about a person on a roof in the 1900 block of K Street NW and confronted a woman who authorities said had threatened to harm herself or others. Police said she had fired shots at an office building near 19th and K streets NW, but no one was injured.

The barricade ended about 10:30 a.m. as they took the woman, identified as Sophia Dalke, 31, of Springfield, Va., into custody. They said she had been charged with assault on a police officer while armed.

A friend said that Dalke had been dealing with financial troubles and family issues, which may have sparked a crisis.

Early Monday, a frantic chain of events began when Dalke e-mailed friends with a subject line that read, “I am sorry to you all but I am ending my life tonight.”

Washington Post reporter Luz Lazo surveys the traffic around M Street and Connecticut Avenue NW, caused by a barricade situation in downtown D.C. Monday morning. (Luz Lazo/The Washington Post)

The text of the e-mail simply had Dalke’s name and a link to a YouTube playlist of “depressing” songs, said Constance Rice, who said she befriended Dalke over the past two years.

Friends sprang into action and connected with some of Dalke’s family members as they tried to locate her, Rice said. Roommates broke down her door in search of her.

“It was mass confusion at 2 in the morning with people who really didn’t know each other,” Rice said.

According to Dalke’s LinkedIn page, she works for a company that has offices at the K Street building. Rice said that friends were concerned she might have planned to jump from an upper floor and that a group of them went to the area.

“Considering that she was armed, I believe the D.C. metro police were stellar in their restraint,” Rice said. “It really could have gone south so easily.

“I feel relieved and sad.”

Authorities closed more than six blocks in the area along 19th and 21st streets, along with blocks of K, L and M streets NW throughout mid-morning.

It created a traffic nightmare for many drivers and pedestrians. By the height of the morning rush hour, some drivers said their commutes had nearly doubled, as streets around Connecticut Avenue NW became parking lots. Metro buses also reported major delays, and some photos on social media showed riders getting off the vehicles in the tunnel at Dupont Circle and walking because their buses were stuck in traffic.

But even after Dalke was taken into police custody, the traffic snarls remained because streets were not reopened until about lunchtime.

Mike Sackie’s ride from Northwest Washington to downtown took 45 minutes instead of the usual 15 minutes. After sitting on the bus for 30 minutes as it was stuck in bumper-to-bumper traffic on Massachusetts Avenue NW, he got off and decided to walk to his job at an optometrist’s office.

“It’s a mess,” he said. “I am already incredibly late and have to walk the remaining four blocks.”

He said he heard about the barricade situation but wasn’t sure it was that bad. Seeing chaotic traffic got him and other commuters nervous.

“It’s a shame and very sad,” Sackie said. “First the attacks in Paris over the weekend, and now we get to deal with this chaos. It’s scary.”

Around 19th Street NW, many office workers arrived Monday morning to find sidewalks and streets blocked, and they stood behind police tape for hours.

Doris Garcia, 53, of Arlington, Va., had been among those waiting to get into her building at 19th and K streets NW for two hours. She had gotten downtown about 8 a.m. and said she thought it would be clear by 10 a.m. But it wasn’t.

“With the way things are happening nowadays, you can’t play it too safe,” she said.

Peter Hermann, Jennifer Jenkins, Faiz Siddiqui and Martin Weil contributed to this report.