BEIRUT, Lebanon — The migrants — average age 16 — were fleeing two desperate places, Ethiopia and Somalia. They were headed to the shores of another, Yemen.

But early Wednesday morning, as they were about to reach land, they were thrown into the Arabian Sea by a boatman they had paid to take them across the water, according to the United Nations migration agency.

At least 50 of them drowned.

Their attempted flight to a country consumed by war was a measure of the desperation of thousands of people from the Horn of Africa, where successive droughts have led to acute shortages of food and water and to outbreaks of disease. Thousands have fled, usually paying smugglers to take them to Persian Gulf countries in search of work.

The route, across the Gulf of Aden and the Red Sea, takes them through Yemen, one of the world’s most dangerous war zones, where airstrikes and mortar shelling have become routine, and a cholera outbreak has affected more than 400,000 people.