A man wearing body armor pointed a semi-auto rifle at two police officers in a California Starbucks, only to have the weapon malfunction before he fled and was shot by the officers nearby, police said Monday.

Vallejo Police Chief Andrew Bidou called it an "attempted assassination" of the two officers, who were on break when the confrontation occurred.

The officers were caught off-guard and "were ambushed by somebody who has superior firepower," the chief said.

Police in Vallejo said Adam Powell, 41, had passed by the Starbucks six minutes earlier, apparently planning the attack.

Police said Powell appeared to keep trying to clear his weapon as he ran away from the coffee shop after the weapon malfunctioned and officers pursued him. Officers shot him three times about 100 feet from the Starbucks.

Powell was in critical condition but stable on Monday. Police Lt. Jeff Bassett told the Associated Press that authorities expect to arraign him within the next few days.

Police said Powell's weapon never fired. A photo provided by police showed a semi-auto rifle bearing wear marks and duct tape. Bassett said the gun was operable except for the jam.

The man also carried a loaded handgun, police said. They described his body armor as "police-style."

The attempted coffee shop attack in Vallejo reminded many in law enforcement of the Lakewood (WA) coffee shop massacre that killed four officers in 2009.