Two boats filled with Somalis and Ethiopians capsized off the coast of Yemen after Yemeni patrol boats chased one of them and fired on two other vessels. At least 17 people drowned and some 140 were missing, the U.N. refugee agency said Thursday.

The incident took place late Wednesday in the Gulf of Aden when Yemeni authorities spotted four boats smuggling 515 people approaching the coastline, the Geneva-based U.N. High Commission for Refugees said.

Click here for FOXNews.com's Africa Center.

The two boats that Yemeni security forces fired on had just offloaded in Yemen and only smugglers were on board, UNHCR said. The smugglers returned fire, according to Yemeni officials, and two other boats still filled with refugees waiting offshore tried to escape to sea in the darkness.

Officials said one of those two boats capsized after passengers became agitated. The other boat was pursued by two Yemeni coast guard vessels and a helicopter and was forced to head back to shore. But about 300 yards from the beach, it capsized in rough seas.

Some of the missing are believed to be trapped under one of the capsized boats, the agency said.

The UNHCR said many of the Somalis claimed they were fleeing the fighting in their country between government forces backed by Ethiopian troops and an Islamic militia. But the boats were launched from a relatively peaceful area of northern Somalia, from where a steady stream of economic migrants has set off in recent years. Reaching northern Somalia across the front lines would have been difficult.

The U.N. High Commissioner for Refugees Antonio Guterres indicated some may have been fleeing persecution and violence while others may be poor migrants who were seeking better economic conditions.

"I am deeply saddened by this latest tragedy involving smugglers' boats carrying desperate people across the Gulf of Aden," Guterres said.

"Brutal smugglers continue to prey on the desperation of poor people fleeing persecution and violence and those looking for better economic opportunities elsewhere," he said.

The refugee agency said the Somalis claimed to be fleeing Baidoa and other areas of central Somalia where fighting has escalated in recent days.

UNHCR said 357 surviving refugees were taken to its Mayfa'a reception center in Yemen where they were given food and medical assistance.

Yemeni authorities were searching for survivors, the UNHCR said. The agency said Yemeni officials claimed to have captured all 17 smugglers and their four boats.

On Wednesday, UNHCR said it was preparing for a possible mass flight of refugees from Somalia to neighboring Kenya and Ethiopia. The agency has asked neighboring countries to provide sanctuary to civilians fleeing the fighting.

Earlier this month, two people were killed when Yemeni authorities fired on smugglers' boats.

According to UNHCR figures more than 25,800 people have fled to Yemen from Somalia this year, and at least 330 people have died and nearly 300 have gone missing during the perilous crossing.

Out of 88,000 registered refugees in Yemen, about 84,000 are Somalis, UNHCR said.