PANAMA President Ricardo Martinelli said on Monday that a North Korean ship captain tried to kill himself after the vessel was stopped en route from Cuba and found to have suspected missile material on board.

Outlining a dramatic sequence of events, Mr Martinelli said the ship was targeted by drug enforcement officials as it approached the Panama Canal and was taken into port, but a search revealed a cargo of far greater concern.

The vessel’s estimated 35-man crew also rioted when police stepped aboard, according to Mr Martinelli, who said the suspicious cargo was found within a large consignment of sugar.

"The world needs to sit up and take note: you cannot go around shipping undeclared weapons of war through the Panama Canal," he told Radio Panama listeners.

"We had suspected this ship, which was coming from Cuba and headed to North Korea, might have drugs aboard so it was brought into port for search and inspection.

"When we started to unload the shipment of sugar we located containers that we believe to be sophisticated missile equipment, and that is not allowed," Mr Martinelli said.

The ship is being held and the crew are in custody.

"The captain has tried to commit suicide, and the crew rioted" during the operation, the president said.

Mr Martinelli, who did not name the boat, said it was headed back to North Korea when stopped and taken to Manzanillo, east of the Atlantic opening of the Panama Canal, which is a major cargo distribution centre.

Cuba is the only one-party Communist regime in the Americas, and a rare ally of also isolated Pyongyang.

The vessel "aroused suspicion by the violent reaction of the captain and the crew from Friday afternoon", Panamanian Security Minister Jose Raul Mulino told the radio station.

North Korea defiantly carried out its third nuclear weapons test in February and then threatened to attack the US, in language that was shrill even by the standards of the reclusive state.

The North has for decades had a programme to develop missiles of all types. In December 2012 it successfully launched a three-stage rocket that placed a satellite in orbit.

Pyongyang said the operation was a peaceful scientific mission but the launch was widely condemned as a covert ballistic missile test banned under United Nations resolutions.

It is unclear whether the North has the technology to build a nuclear warhead for a missile.