The Panama Canal was at the centre of a claimed arms trafficking attempt on Tuesday when authorities said they had detained a North Korean flagged ship on its approach to the waterway from Cuba and found weapons on board.

The Panamanian president, Ricardo Martinelli, said the ship was carrying "undeclared weapons of war" to North Korea and accused it of violating United Nations resolutions against arms tracking.

Neither the Cuban government nor its communist ally in North Korea commented on the seizure. Martinelli said that the undeclared military cargo appeared to include missiles and non-conventional arms, which were found hidden in containers of brown sugar after Panamanian authorities stopped the ship suspecting it was carrying drugs. The vessel was pulled over near the port of Manzanillo on the Atlantic side of the canal.

"We're going to keep unloading the ship and figure out exactly what was inside," he told Panamanian television.

"You cannot go around shipping undeclared weapons of war through the Panama Canal."

By Tuesday afternoon, Panamanian authorities had only searched one of the ship's five cargo holds, said Luis Eduardo Camacho, a spokesman for the president. Martinelli tweeted a picture of the weapons, showing what appeared to be a green tubular object.

He said 35 North Koreans were on the boat and they resisted police efforts to take the ship to Manzanillo. They were later taken into custody. The captain of the vessel had a heart attack and tried to commit suicide after the ship was stopped, Martinelli added. Authorities were tipped off some days ago that the ship might be carrying drugs, according to the president.

Hugh Griffiths, an arms trafficking expert at the Stockholm International Peace Research Institute, said the seized ship is called Chong Chon Gang and has been on the institute's suspect list for some time, having previously been caught trafficking drugs and small arms ammunition. He said that earlier this year the institute reported to the UN a discovery it made of a flight from Cuba to North Korea that travelled via central Africa.

"Given the history of North Korea, Cuban military co-operation and now this latest seizure, we find this flight more interesting," he said. "After this incident there should be renewed focus on North Korean-Cuban links." . Under UN security council resolution 1718, adopted in 2006 after North Korea claimed to have conducted a nuclear test, all member states are required to prevent the import from or export to North Korea of "any battle tanks, armoured combat vehicles, large calibre artillery systems, combat aircraft, attack helicopters, warships, missiles or missile systems". In February, sanctions were expanded after North Korea carried out its third nuclear test.

The canal authority says that security inspection of a vessel can be triggered by a failure to comply with the 96-hour pre-arrival notice requirement, wrong or missing information in documentation provided by the vessel, or by order of the Panamanian authorities.

Around 14,000 ships pass through the canal each year, representing about 5% of world trade. Panama has been running the 82km (51 mile) waterway since 1999, when the US handed over control, and it is the country's main source of revenue.