(CNN) -- Somali President Sheikh Sharif Sheikh Ahmed said Saturday he will give in to a rebel demand that he impose Islamic law, or sharia, in an effort to halt fighting between Somali forces and Islamic insurgents.

President Sheikh Sharif Sheikh Ahmed says sharia law in Somalia will not be strict.

However, Ahmed told a news conference he won't agree to a strict interpretation of the law, which forbids girls from attending school, requires veils for women and beards for men, and bans music and television.

The president, speaking at his palace in the capital, Mogadishu, said local elders and religious leaders, acting as liaisons with the militants, brought him a message saying the rebels wanted a truce in the two-year-old fighting. He also asked African peacekeepers to stand down.

Ahmed, who was elected January 31, said he would ask the AU contingent to leave once there is a solid political solution to the conflict.

More than 40,000 Somalis have returned to abandoned neighborhoods in Mogadishu over the past six weeks, despite some of the heaviest fighting in months, the U.N. High Commissioner for Refugees said Friday.

Don't Miss

They are part of the more than a million residents who have been displaced by fighting in Somalia, including 100,000 who fled to neighboring countries last year alone, according to the United Nations.

Ethiopian troops entered the country at its request in December 2006. The Ethiopians ousted the Islamic Courts Union, an Islamic movement that had claimed control of Mogadishu earlier that year.

Ethiopia's action had the blessing of the United States, which accused the Islamic Courts Union of harboring fugitives from al Qaeda. But various Islamist groups -- including al-Shabab, which the United States has designated a terror organization -- rejected the presence of Ethiopian forces and mounted an insurgent campaign against the Ethiopians and the transitional government.