A deputy was recovering after being stabbed early Friday during a violent encounter with a man at a homeless housing project in the Goleta Valley, according to the Santa Barbara County Sheriff’s Office.

The deputy was among several who responded shortly after midnight for a welfare check at La Posada, 4500 Hollister Ave., said Raquel Zick, sheriff’s public information officer.

The man — Abu Bakr Sugich, 44 — “called Sheriff’s Dispatch in an agitated state and made alarming statements indicating he intended to harm someone,” Zick said.

Deputies found Sugich near the northeast corner of the property, Zick said, and he appeared extremely agitated.

She added that deputies maintained their distance from Sugich and made repeated efforts to de-escalate the situation.

“During the encounter, Sugich briefly walked away before returning and advancing toward a deputy,” Zick said. “Without warning, Sugich produced a black hunting-style knife and stabbed Deputy Fabian Flores in the upper chest.”

The other deputies quickly subdued Sugich and placed him in handcuffs.

Flores received immediate medical attention at the scene, then was transported by American Medical Response ambulance to Santa Barbara Cottage Hospital, where he was treated and released.

Sugich was booked into the Santa Barbara County Jail on suspicion of felonies including attempted murder and assault with a deadly weapon, Zick said.

He remained in custody Friday afternoon, with bail set at $1 million.

“This incident highlights the unpredictable and dangerous nature of law enforcement work, and the critical importance of de-escalation, teamwork, and rapid response in protecting both the public and our personnel,” Zick noted.