JAKARTA, Indonesia — In the latest of a wave of apparent terrorist attacks in Indonesia, four sword-wielding men were shot dead on Wednesday after ramming a car into a security checkpoint at a provincial police headquarters on the island of Sumatra and attacking officers, the police said.

One police officer died in a hospital after being hit by the vehicle, while two others suffered cuts in the attack, which happened shortly after 9 a.m. in Pekanbaru, the capital of Riau Province in central Sumatra, Inspector General Setyo Wasisto, a spokesman for the national police, told reporters.

“When entering, their car was blocked by Riau police officers. They then got out of the car and attacked the police guards using long swords,” he said.

An Indonesian news reporter who happened to be on the scene was also hurt.

A fifth person in the attackers’ car drove off, hitting the police officer who later died, before eventually being captured by pursuing officers.