Pirates boarded the Danish freighter Lindinger Ivory anchored outside the Nigerian port of Lagos, shot and knifed the ship's captain and wounded all 14 crewmembers, the ship's owners said today.

Piracy, usually carried out by armed gangs using small boats, has become an increasing problem for ships visiting Lagos. Because of congestion in the harbor itself, foreign freighters are forced to wait off the coast, sometimes for as long as several months.

The incident triggered a joint demand from the five Nordic countries that Nigeria provide greater protection for foreign ships. A Danism seamen's union called for a boycott of Nigerian ports.

The Lindinger line said that Capt. Sonnich Kromman Frederiksen, 44, was thrown overboard after being wounded. His body has been found and he is presumed dead. One Indonesian crewmember had his eyes put out by the marauders.

About 20 pirates boarded the ship Monday morning while it was anchored outside the harbor, waiting for a berth. The raiders stayed on the ship about two hours and stole typewriters, liquor, cigarettes and other personal belongings, a spokesman for the shipping line said. The ship was carrying a cargo of chemcals.

As a result of the attack on the Lindinger Ivory, the government of Denmark, Norway, Sweden, Finland and Iceland demanded today that Nigeria take immediate steps to protect foreign ships a spokesman for the Danish Foreign Ministry said.

The spokesman said the demand would be presented Wednesday to the Nigerian Foreign Ministry "in unmistakable terms" and in a way that would leave the Nigerian government with no alternative to a quick response.

The Nordic governments did not threaten Nigeria with a shipping boycott, the spokesman said. Nevertheless, Denmark's Association of Seafarers today urged the London-based International Transport Workers Federation to call a boycott of Nigerian ports.