An attacker stabbed a California Highway Patrol officer multiple times in San Francisco Tuesday morning before other officers put him in handcuffs outside a bank about a mile from the downtown site of Super Bowl 50 festivities.

The officer was listed in stable condition at San Francisco General Hospital and was expected to survive after being slashed across the throat and stabbed in the upper torso with a knife, CHP officials said.

The officer, a seven-year CHP veteran who has not been identified, was attacked about 10 a.m. near the Essex on-ramp to the San Francisco-Oakland Bay Bridge at Harrison Street, which is also not far from where homeless people have been camping out, especially as Super Bowl-related events and installations have taken over other parts of the city.

Thanks to all who have reached out about the @CHPSanFrancisco officer who was injured today. The officer is in stable condition. — CHP Golden Gate (@CHP_GoldenGate) February 2, 2016

Police spokesman Albie Esparza said the officer was responding to reports of a pedestrian wandering on a freeway. They didn't find the person, but as they questioned a man near some roadside tents, they say things got ugly.

"The officers made contact with the subject and during that enforcement contact the subject attacked one of the officers," CHP Commander Chris Sherry said.

The suspect, identified by police as 44-year-old Noel Corpuz, was arrested less than half-a-mile away outside the Wells Fargo at 490 Brannon Street. A backpack that contained a butcher's knife and belonged to the person was recovered, police said.

"We don't know the history of the suspect," Sherry said. "We don't know what prompted this attack on the officer."

A witness said Corpuz seemed mentally ill.

Emily Seip was working in an office building when she heard sirens wailing for about half an hour then a commotion outside.

She looked out her window and saw police arresting a man.

"There was a fair amount of what looks like blood on his (clothing)," she said.

Witness John Oshima said he watched the incident unfold while he sat in his parked van.

"He was acting crazy, yelling and screaming," Oshima said. "When they eventually got off of him there was a pretty big hunting knife on the ground next to where he was laying."

Corpuz has been booked into county jail for attempted murder, aggravated assault and resisting arrest, police said.

The stabbing and subsequent investigation prompted the temporary closure of on- and off-ramps near 4th and Bryant streets and 3rd and Essex streets, police said.