A man wielding a kitchen knife was fatally shot after he allegedly ran towards a police officer in Japan’s Osaka prefecture.

The Osaka police said they answered an emergency call at around 7pm local time on Tuesday about a man holding a knife and acting violently near the entrance of a market in the Kawachinagano area.

The police sent five officers who found the man on a nearby street and ordered him to drop the knife.

The man refused to heed the order despite one of the police officers firing a warning shot into the air.

The knife-wielding man continued to approach the officer, prompting him to shoot. The bullet hit the left side of the man’s chest.

He was taken to a local hospital where he was declared dead, the police said.

Shooting by the police is rare in Japan.

The law allows police officers to use weapons only if they consider it necessary to arrest a suspect, prevent an escape, protect themselves or others, or overcome resistance to the execution of their official duties.

The Osaka police said the officer's use of the firearm appeared to meet the legal requirements while expressing regret over the man's death.

Authorities said they were investigating the circumstances surrounding the shooting and the man's identity.

Earlier in July, a police officer in Kumamoto prefecture opened fire on a 21-year-old knife-wielding man, who was allegedly robbing a convenience store.

The officer fired a warning shot and then proceeded to fire three more rounds at the suspect. The man was struck by two bullets on his right shoulder and right thigh.

The Kumamoto police said the use of the firearm was appropriate as the suspect failed to comply with the officer's order and continued pointing the knife.

Violent crimes are rare in Japan.

But there have been several high-profile attacks in recent years, most notably the 2022 assassination of former prime minister Shinzo Abe.