A man in his 40s apparently lost both his hands Friday when a firework he was holding prematurely exploded, San Jose Police reported. And in Sunnyvale, a mortar-type firework blew off the fingers of two men, officials said.

Police did not identify any of the men, who were transported to local hospitals.

San Jose Police Officer Albert Morales said that police were summoned at 9:44 p.m. to the 1300 block of Leeward Drive, near Cassel Park and the intersection of Story Road and Capitol Expressway in East San Jose. A man igniting illegal fireworks, as family members stood nearby, was injured when the device exploded, Morales said. The blast blew off both the victim’s hands, Morales said.

He is expected to survive.

The type of device was not identified. “It would have had to have been something pretty powerful,” Morales said.

The Sunnyvale Department of Public Safety said it responded after a patrolling officer saw and heard an explosion just before 10 p.m. Friday at an apartment complex on 727 East Duane Ave., near the intersection of North Fair Oaks Avenue. Two men, ages 41 and 32, emerged from a group of 20 people and approached the officer.

Witnesses said the two men had been trying to ignite a mortar-type firework when it went off in their hands. For one man, the firework blew fingers off his left hand and fingertips off his right hand. The other was missing part of his right hand. The officer treated the men for injuries at the scene before they were taken to the hospital.

Staff writer Mike Rosenberg contributed to this report. Contact Sharon Noguchi at 408-271-3775. Follow her at Twitter.com/noguchionk12.