Image copyright AFP Image caption Last year saw weeks of anti-China protests in Vietnam over the islands

China has freed 21 Vietnamese fishermen detained last month near disputed islands in the South China Sea, officials say.

China accused the men of fishing illegally in waters around the Paracel Islands, which it has occupied since 1974.

Vietnam, which also claims the islands, said the men were held in its waters.

The row came amid rising regional tensions over competing territorial claims in the area.

Officials said the men were released on Friday after giving written guarantees, the Xinhua news agency reported.

The fishermen pledged "not to infringe on China's maritime rights, especially fishing, in its territorial waters", the South China Sea Fishery Bureau was quoted as saying.

The statement said the Vietnamese boats were loaded with explosives and other equipment used for dynamite fishing.

Vietnam lodged a formal protest after the fishermen's detention on 3 March, and demanded their immediate and unconditional release.

Tensions have been on the rise recently over both countries' claims to the Paracels, a chain of small islands and reefs occupied by China since a brief war in 1974.

A week before the Vietnamese fishermen's detention, Vietnam said China "seriously violated" its sovereignty by allowing bidding for oil exploration near the Paracel Islands.

Conflicting claims

The South China Sea, thought to be rich in oil and natural gas reserves, has been a source of maritime conflict between several countries.

Along with China and Vietnam, islands in the area are also claimed by the the Philippines, Brunei, Malaysia and Taiwan.

China claims almost all of the sea, at certain points nearly right up to other countries' coastlines.

Since 10 April, a Philippines naval vessel has been locked in a stand-off with Chinese surveillance ships at the Scarborough shoal, which is claimed by both countries.

On Friday China sent a third patrol ship to reinforce the two already in the area. The dispute began when Manila accused Chinese fishermen of poaching in its waters. Beijing said the fishing boats are legally there.

Earlier this week, Philippines-US forces launched a fortnight of naval exercises in nearby seas.

China's top military newspaper warned the US on Saturday that the drills had heightened the risk of armed confrontation in the area.

"Anyone with clear eyes saw long ago that behind these drills is reflected a mentality that will lead the South China Sea issue down a fork in the road towards military confrontation and resolution through armed force," a commentary in the Liberation Army Daily said, according to the Reuters news agency.

Correspondents say the commentary marks the harshest high-level warning yet from Beijing about the tension with the Philippines.