North Korea thanked the United States Thursday for helping one of its ships repel pirates, a rare expression of gratitude that was the latest sign of improving relations as the North scales back its nuclear weapons program.

The North's Korean Central News Agency hailed the rare maritime collaboration as a "symbol of cooperation" between the two countries "in the struggle against terrorism," and pledged to work with the international community to fight terrorism.

The cooperation between the countries at sea was unprecedented, historians said. The last notable maritime encounter between the two countries was in 1968 when the North seized the USS Pueblo while it was on an intelligence-gathering mission off the country's coast. The ship is the only active-duty U.S. warship in the hands of a foreign power, and remains on display as a tourist attraction in the North Korean capital.

Get Breaking News Delivered to Your Inbox

It was the second time in about two months for Pyongyang to thank Washington - a rare move seen as reflecting the friendly mood between the two countries spawned by progress in their prolonged standoff over the North's nuclear weapons programs.

In September, the North's Foreign Ministry issued a statement thanking the U.S. for providing emergency relief supplies after the severest floods in decades devastated the impoverished nation.

"The pirates' recent armed attack on our trading ship was a grave terrorist act perpetrated against a peaceful ship," KCNA said. "We feel grateful to the United States for its assistance given to our crewmen."

The KCNA dispatch was the first reaction from Pyongyang to last week's incident where the U.S. Navy boarded the North Korean ship Dai Hong Dan to provide medical assistance at the crew's invitation after they had already overpowered and detained all pirates.

KCNA said the USS James E. Williams and a helicopter rushed to the scene and "helped the (North Korean) sailors in fighting, threatening the pirates over walkie-talkie."

In Washington, U.S. State Department spokesman Sean McCormack, asked about North Korea's gratitude for U.S. help against the pirates, said: "We fulfilled our responsibilities as a responsible member of international maritime organizations and treaties and responded to a distress signal on the high seas."

The piracy came as relations between Washington and Pyongyang have improved on progress in their nuclear dispute.

The main U.S. nuclear envoy, Assistant Secretary of State Christopher Hill, said Friday last week that the U.S. military helped the North Korean ship as a goodwill gesture.

Pyongyang shut down its sole functioning nuclear reactor in July and has begun disabling the facility this week under a February deal with the United States, China, Japan, South Korea and Russia.

U.S. and South Korean officials have praised the North for being "very cooperative."

The incident also came as the United States is considering removing North Korea from the U.S. list of states sponsoring terrorism as a reward for Pyongyang to shut down and disable the Yongbyon nuclear reactor that produces plutonium for bombs.

Pyongyang tried to seize on the piracy standoff to accelerate the process of its removal from the U.S. terror list.

"It is the consistent principled stand of the (North Korean) government to oppose all sorts of terrorism," KCNA said. "We will continue to render international cooperation in the fight against terrorism, in the future, too."

North Korea was put on the terror list for involvement in the 1987 bombing of a South Korean civilian jet that killed all 115 people aboard.

Pyongyang has long demanded it be removed from the list, claiming that the designation is a sign of U.S. hostility.

KCNA said that seven pirates, "disguised as guards," boarded the North Korean vessel on Oct. 29, and demanded that the sailors pay them $15,000 and move the ship to the waters they want.

"The sailors, however, remained unperturbed under this dangerous situation created all of a sudden. They fought to beat back the pirates' attack," it said. "As shown by our crewmen through their actions, it is the disposition of the Korean people to fight out any terrorist act on the spot though they are empty-handed."