SAN FRANCISCO (CBS SF) — San Francisco police on Friday apprehended a man sought in connection with a two-alarm house fire in the Castro that displaced six residents.

The San Francisco Fire Department said the fire was burning a two-story detached building on the 100 block of Eureka St. at 18th St. in San Francisco’s Castro District.

READ MORE: Pulitzer-Winning San Francisco Composer Wayne Peterson Dies at 93

Before the flames started, police officers had responded to the site for a report of a person screaming, the San Francisco Police Department said.

“All of a sudden a commotion happened, so I went and opened the window,” said area resident Oscar Paltero.

Officers made contact with an adult male armed with a knife who then fled from the officers, police said. As officers were searching and establishing a perimeter, smoke began coming from a building on that block.

“During the officers’ search, officers noticed smoke billowing from a structure on the 100 block of Eureka Street and summoned fire personnel immediately,” explained San Francisco Police Officer Robert Rueca.

The neighborhood then found itself with a fire on top of the search for the armed man.

“This was a fire, but I got outside and there were just as many cops as there were fire engines,” Paltero says.

A short while after the fire was extinguished, police were able to close in on the man they had been looking for.

READ MORE: Danville Officer Who Killed 2 Suspects In Separate Police Shootings Booked On Manslaughter, Assault Charges

“We found him in a backyard, hiding from us,” Rueca said. “He is currently in custody and was transported to the hospital for injuries possibly resulting from the fire.”

The fire department said five adults and two cats were displaced. There were no injuries reported.

Police had earlier in the day asked residents to avoid the area as officers investigated, but the area has since reopened.

Supervisor Rafael Mandelman, whose district includes the area, said he’s spoken to most of the displaced residents and his office was working to assist them.

Anyone with information regarding this investigation is asked to call the SFPD 24-hour Tip Line at 1-415-575-4444 or Text a Tip to TIP411 and begin the text message with SFPD.  You may remain anonymous.

MORE NEWS: FAA Plan To Shift Air Traffic Patterns Over East Bay Gets Dropped Following Outcry

Wilson Walker contributed to this story.