The Danish military said the frigate Esbern Snare spotted the suspected pirate ship near several merchant ships.
The Danish armed forces said that a Danish naval patrol had killed four pirates in an exchange of fire in the Gulf of Guinea, off the coast of Nigeria.
“No Danish soldier was injured, but five pirates were shot,” the military said on Thursday.
Four pirates died. One of them was wounded.”
A spokesman said the accident occurred outside the territorial waters of Nigeria.
The accident occurred on Wednesday when the frigate Aspirin Snir, which has been patrolling the area since early November, attempted to board the pirate boat.
Danish forces fired warning shots, and the pirates immediately responded with fire.
“The Danish soldiers acted in self-defense and returned fire,” the statement said.
This is the first time that the frigate has opened fire during the current mission in the Gulf of Guinea, the spokesman said.
The military said the remaining four pirates were taken aboard the frigate. After the shooting, the pirate ship sank.
The Gulf of Guinea, a piracy hotspot stretching 5,700 kilometers (3,540 miles), from Senegal to Angola, saw 195 attacks in 2020.
That same year, 130 of the 135 hostage-takings at sea occurred in the area, according to the International Maritime Bureau.
Danish Defense Minister Trine Bramsen told Ritzau news agency that the Danish frigate, equipped with helicopters and 175 sailors, “is carrying out an important task of protecting Danish and other merchant vessels in the region.”
Copenhagen announced in March that it would send the ship to patrol the region, where 40 Danish ships operate daily.
Danish Prime Minister Mette Frederiksen and main opposition MP Jacob Ellmann had planned to visit the frigate during a visit to Ghana on Wednesday and Thursday.
Danish tabloid Extra Bladet reported on Thursday that they were not on board the frigate during the accident.
The frigate will operate in the Gulf until April next year.