MOGADISHU, Somalia — Barely 12 hours after a failed coup in Turkey, Somalia’s cabinet met to consider a request from Turkey to shut down two schools and a hospital linked to Fethullah Gulen, the Muslim cleric whom the Turkish president blames for the attempted coup.

The influence of Turkey in Somalia, where it has spearheaded international reconstruction efforts after decades of war and instability, is so strong that it was not a difficult decision.

Teachers and pupils — almost all of them Somali — at the two boarding schools run by Mr. Gulen’s Nile Academy educational foundation were given seven days to pack their bags and leave the school.

“Considering the request of our brother country Turkey, the cabinet ministers have agreed upon the following points — to stop the services provided by Nile Academy including schools, hospitals, etc.,” the Somali government said in a statement on July 16.