All but three of the 35 North Korean crew members detained when authorities found that their ship was carrying weapons from Cuba will be released from prison and allowed to return to their country, a Panamanian official said.