Three people including two police officers were killed in Nagano in central Japan on Thursday and a suspect with a rifle and knife was holed up inside a building, police said.
NHK public television said a person later escaped from the building and that some other people might still be inside.
A witness told NHK that a woman fell while being chased by the suspect, who then stabbed her with a knife and shot at two police officers as they arrived at the scene in a patrol car in Nakano city in Nagano prefecture.
The witness said he asked the suspect why he attacked her, and he replied that he wanted to kill her, NHK said.
The three victims were taken to a nearby hospital, where they were later pronounced dead, police said. A fourth person who was injured could not be rescued because he was near the suspect, Kyodo News agency reported.
Video on NHK showed police wearing bulletproof vests and carrying shields, with an ambulance nearby. The area is in a quiet farming neighborhood.
Police described the suspect as a man wearing a camouflage outfit, a hat, a mask and sunglasses, Kyodo News said. Police set the area within a 300-meter (330-yard) radius of the site as no-go zone, and city officials urged people in the neighborhood to stay home.
No other details, including about the suspect and the motive, were immediately known.
Violent crimes are rare in Japan. It has strict gun control laws and only a handful of gun-related crimes annually. But in recent years, there have been some high-profile cases involving random knifings on subways and arson attacks, and there is growing concern about homemade guns and explosives.