San Jose police on New Year’s Day averted a potential lethal situation by safely arresting a mentally disturbed, naked man armed with a samurai-like sword and a loaded assault rifle.

“This could have gone really, really bad,” said Officer Albert Morales, a police spokesman, of the incident that began about 8 a.m. “Things could have turned out very differently.”

At one point, 32 officers had descended on the scene at Southwest Expressway and Bascom Avenue, cordoning off the area and trying to negotiate for nearly two hours with the distraught man. He repeatedly yelled, “You’re going to have to kill me,” Morales said.

By 11 a.m., police had arrested Coco Bennett, 29. He was taken to the jail ward at Santa Clara Valley Medical Center for injuries he suffered after he leaped over a fence and fell, Morales said.

The successful arrest was a victory for San Jose police and its Crisis Intervention Team, which is trained to deal with mentally ill people.

The confrontation follows several less fortunate incidents in San Jose that ended with the assailant’s death, including a situation in 2010 in which police killed a 42-year-old man who was wielding a 10-inch knife in an apartment building in South San Jose.

In 2009, San Jose police shot and killed a mentally ill man armed with a knife who had attacked his brother. In 2003, police killed a woman wielding a vegetable peeler, which an officer mistook for a cleaver.

The incident on New Year’s Day began at 8:05 a.m. when police received a call about a man with an assault rifle in front of a residence near Ezie Street and Cas Drive. The caller was able to note a partial license plate number as the man drove away in a white pickup truck.

Police tracked the man down to Southwest Expressway and Bascom Avenue, where he’d stopped in a Valley Transit Authority parking lot.

Concerned about the assault rifle, police kept their distance and watched as the man struggled with something in the cab of his truck. It turned out he was taking off all of his clothes — on a day when the temperature was a chilly 54 degrees.

Morales said the man emerged from the truck brandishing a large samurai-like sword, refusing to drop the weapon.

“We were lucky it wasn’t the assault rifle, or things might have been a lot different,” Morales said.

Officers were able to approach the truck and confiscate the gun early on. But they were locked in a standoff with the man for about an hour and a half, Morales said.

At one point, officers used a flash-bang device to distract the suspect, but Morales said it’s unclear if that’s what drove him to run away.

While jumping over a fence, the man fell on his head and dropped the sword. Police were able to grab it and arrest him.

Major streets that had been cordoned off, including parts of Bascom and Hamilton avenues, were reopened about 11 a.m.

Morales said investigators are trying to track down how the man obtained the rifle.

Contact Tracey Kaplan at 408-278-3482. Follow her at Twitter.com/tkaplanreport.