SAN DIEGO — A man who threatened to commit "suicide by cop" holed up in a Hillcrest hotel and fired a gun in the direction of responding officers, prompting a non-injury shootout and a SWAT standoff that last more than 15 hours before he was taken into custody without incident this morning.

The events that led to a Thursday afternoon exchange of gunfire in the 3700 block of Fourth Avenue in San Diego began Wednesday evening, when a man in his early 20s called a crisis hotline to say he was suicidal and wanted the police to end his life, SDPD Lt. Shawn Takeuchi said.

It was not immediately clear exactly where in the city the man was, but after members of his family contacted police, officers determined that he was staying at Abpopa Hillcrest, a multi-story "micro loft" building about 10 blocks northwest of Balboa Park.

After arriving at the building about midnight and not getting an answer at the man's third-floor room, officers elected to depart to avoid the chance of forcing a violent confrontation with him.

About 9:30 a.m. Thursday, the man, whose name was not released, called the police, told a dispatcher he had a gun and said he wanted to use it to make officers have to shoot him to death, Takeuchi said.

Patrol personnel then returned to the building, where they tried in vain for more than three hours to persuade the man to disarm himself and surrender.

Shortly after 1 p.m., the man shot a gun out a window in the direction of officers, prompting one of them to return fire. Though witnesses told news crews eight to 10 shots had sounded, there were no reports of injuries.

At that point, police evacuated the building along with nearby residences and businesses, cleared pedestrians out of the area and closed surrounding streets to through traffic.

SWAT personnel, including snipers, took up positions around the building where the man was hunkered down, and administrators at Florence Elementary School, several blocks to the northwest, put the campus on lockdown as a precaution.

The man was taken into custody around 12:45 a.m. Friday "without incident", according to Officer Robert Heims. There were no immediate reports of any injuries related to the incident.