JAKARTA (Reuters) - The captain of a sinking Indonesian ferry managed to steer his ship onto a reef to enable the evacuation of more than 100 passengers, but 31 people drowned as the vessel floundered in stormy seas, officials said on Wednesday.

The latest ferry disaster in Indonesia, which happened on Tuesday near Sulawesi island, came two weeks after an overcrowded ferry sank on Lake Toba in Sumatra, one of the world’s deepest volcanic lakes, with the death of more than 200 people.

The national search and rescue agency said the boat that ran into trouble near Sulawesi had been carrying 164 passengers and crew. Three passengers were missing but 130 had been rescued, a transport ministry official said.

The ferry was also carrying 48 vehicles when it began taking on water in bad weather.

“The captain ran it onto a reef so it wouldn’t sink and to make the evacuation of passengers easier,” Agus H. Purnomo, the director general of sea transportation, said in a statement.

“The captain and the owner of the ship were the last two people to come down from the passenger ship,” he added.

Television images showed dozens of passengers hanging on to the keeling vessel or bobbing in the water wearing life jackets.

Indonesia, a vast archipelago made up of more than 17,000 islands, suffers frequent boat accidents, with basic safety rules often flouted and vessels overloaded.

After last month’s sinking in Sumatra, one of the deadliest in nearly a decade, a two-week search and rescue effort found the vessel at a depth of 450 m (1,500 ft) with victims trapped inside, but technical and logistical challenges forced the recovery to be called off.