SARATOGA — A man said to be acting suicidal was shot in the chest and killed after attacking sheriff’s deputies with a blunt metal object around noon Tuesday, sending two deputies to the hospital for treatment.

The attack happened on the street near an office park at the intersection of Saratoga and McFarland avenues. Workers at the complex called authorities to report a man was behaving erratically.

“What they declared made the dispatcher say it involved a suicidal suspect,” said Santa Clara County Sheriff’s Sgt. Kurtis Stenderup. “Fire crews got to the scene first, and saw the subject. When the deputies arrived, an altercation ensued, and the suspect struck at least one of them with a blunt object.”

Stenderup said the man “suddenly became agitated” and the deputy “feared for his life and fired his firearm once at the subject, striking him in the chest.”

Stenderup said the man was still combative after being shot and had to be restrained before medical aid could be administered.

The Santa Clara County Medical Examiner’s Office confirmed Tuesday evening that the man died at Valley Medical Center, but they had not identified him.

The deputies were treated for unspecified injuries and released from a hospital. Tuesday night, Stenderup said the deputies as well as Santa Clara County firefighters and other medical personnel who witnessed the shooting were being interviewed by investigators.

A spokeswoman for Roku, a video and music streaming service at the intersection where the shooting took place, said in an email that the company’s “priority is looking after the well-being of our staff and supporting the sheriff’s office in their investigation.”

Stenderup did not know when the last time an officer related shooting happened in Saratoga but said it was very rare.

The affluent town of about 30,000 was named the safest City in California last month in a report by SafeWise Security Systems, and last year the Saratoga Union School district was named “most attractive” in the country for families with school-age children.

A deputy was involved in another fatal shooting Nov. 16, in which a 61-year-old woman was shot in unincorporated San Jose when she refused to drop a knife and advanced on the officer.

The sheriff’s office said in that case, deputies repeatedly tried to back away from Andrea Naharro-Gionet, but a female officer was cornered in a driveway and fired when the woman raised the knife in a threatening manner.

In September, a man was shot and killed by six undercover agents in Sunnyvale when he appeared to be reaching for a gun during a drug sting, officials said. The officers involved included five Santa Clara detectives and one Santa Clara County sheriff’s investigator.

Witnesses to Tuesday’s incident and shooting are asked to call sheriff’s investigators at 408-808-4431.

Contact Eric Kurhi at 408-920-5852. Follow him at Twitter.com/erickurhi.