A domestic violence suspect barricaded himself inside his Mission District apartment at 9 a.m. on Friday after police officers came to arrest him for an incident with his wife the night before, resulting in an hours-long standoff with police and lockdown of the apartment building.

At 3:18 p.m., the man was arrested for felony domestic violence by police officers after six hours of negotiations.

“They came up with an agreement the guy could live with,” said Captain Daniel Perea of the Mission Station without going into details.

Dozens of police officers and some 10 squad cars had cordoned off Folsom Street between 14th and 15th streets for hours on Friday, and a SWAT team in a nearby alleyway was on hand in case the situation escalated.

At 12 p.m., police officers on scene at 1803 Folsom St. between 14th and 15th streets were “waiting it out” because the man was thought to be unarmed and were in communication with the man through his apartment door.

“We are giving him time and space and waiting it out,” said Perea, adding that the SWAT team was necessary “in case he sets building on fire or something like that.”

The 30-year-old man, who was unidentified by police officers, was reportedly involved in a domestic violence dispute on Thursday night with his wife, who called the police on him last night after she was injured, according to Perea.

The man then fled their apartment after the police showed up to arrest him, Perea said. His wife went with the police, who put her up in an crisis shelter for battered women after deeming it was unsafe for her to stay at home.

On Friday morning, the wife — who is around the same age as her husband — went back to their apartment at 1811 Folsom St. to retrieve some belongings and found her husband at home.

“Upon entering she found her husband there,” said Perea. “She then flagged down cops fearing for her safety.”

“The guy left last night and she probably thought he wasn’t coming back,” he added.

The wife flagged down a passing squad car and police officers told her not to go back inside the building. More officers arrived on scene and attempted to arrest the man for felony domestic violence when he locked himself in his apartment, refusing to come out.

Other residents inside the single-story, multi-unit building were allowed to remain inside their apartments. Two officers inside the building were speaking to the man and monitoring the situation.

The man was “known to police” previously, according to Perea. The wife of the man was also on scene in a squad car in case he makes demands to speak with her, Perea added.

Peter McTigue, a resident of the building, said he and other neighbors have heard arguments coming from that apartment before, including last night.

“Last night my girlfriend heard them arguing and banging on things,” he said. “They have a weird dynamic, he always seems a little strange.”

“I left to get coffee and I heard the officers talking to him through the door, but he was refusing [to come out],” he said. “I’m surprised at the escalation of this because it seems like he’s not a immediate danger if he’s not armed.”

Chris Diaz, the general manager at Alioto’s Garage down the block, said he was concerned for his workers.

“I keep walking out periodically to check if things have settled down and I told my employees to stay inside for their lunch breaks,” he said, adding that the cops informed him he and his employees were not in danger. Diaz said he saw the situation escalate as the initial squad car was joined by more and more throughout the morning, saying the cars eventually lined the block.

He didn’t himself see anything happen within the building, but said he heard loud sounds.

“I didn’t see anything and I don’t know who lives in the building,” he said. “But I did hear noises this morning that sounded like someone yelling and banging.”

Captain Daniel Perea. Photo by Lola M. Chavez

Captain Daniel Perea. Photo by Lola M. Chavez

Photo by Lola M. Chavez

Photo by Lola M. Chavez

Photo by Lola M. Chavez

Photo by Lola M. Chavez

SWAT stand by.  Photo by Lola M. Chavez

SWAT stand by. Photo by Lola M. Chavez

Photo by Lola M. Chavez

Photo by Lola M. Chavez

Suspect taken into custody Friday at 3:18 p.m. Photo by Lola M. Chavez

Suspect taken into custody Friday at 3:18 p.m. Photo by Lola M. Chavez