Panama detained a North Korean-flagged ship from Cuba as it headed to the Panama Canal and said it was hiding weapons in brown sugar containers, sparking a standoff in which the ship's captain attempted to commit suicide.

Panama detained a North Korean-flagged ship from Cuba as it headed to the Panama Canal and said it was hiding weapons in brown sugar containers, sparking a standoff in which the ship's captain attempted to commit suicide.

President Ricardo Martinelli said the undeclared weapons were detected inside the containers when Panamanian authorities stopped the ship, suspecting it was carrying drugs.

"We're going to keep unloading the ship and figure out exactly what was inside," he told Panamanian television late on Monday. "You cannot go around shipping undeclared weapons of war through the Panama Canal."

It was unclear what the weapons were but a photo posted on Martinelli's official Twitter page showed a long missile-shaped object with a tapering, conical end inside the ship.

IHS Jane's said it had identified the equipment shown in the images as an RSN-75 'Fan Song' fire control radar for the SA-2 family of surface-to-air missiles.

Martinelli said the captain of the vessel tried to commit suicide after the ship was stopped near the port of Manzanillo on the Atlantic side of the canal.

The president said the crew resisted efforts by Panamanian authorities to redirect the ship, named Chong Chon Gang, to Manzanillo and 35 crew members were detained.

A spokeswoman for the canal said she did not have any more information. The attorney general's office did not immediately return requests for comment.

Javier Caraballo, Panama's top anti-drugs prosecutor, told local television the ship was en route to North Korea.

North Korea, a reclusive and impoverished Asian nation, is under tough sanctions enacted by the United Nations, the United States and the European Union, including a U.N. ban on all arms exports due to its controversial nuclear weapons program.

Previous violations of sanctions included North Korean shipments of arms-related material to Syria in November 2010 and rocket fuses for Iran in 2008, according to a U.N. report in May.

Sanctions were toughened after the country's February nuclear test and its vow to continue developing nuclear weapons, saying it fears an attack by the United States.

Shipping data obtained by IHS Maritime research group showed that the Chong Chon Gang arrived at the southern end of the Panama Canal on May 31. It passed through the canal on June 1, with a stated destination of Havana, Cuba.

After that it disappeared from the tracking system and reappeared in Manzanillo, Panama, on July 11. IHS said there were indications it had changed cargo in the interim.