In a BBC report Sunday, Farmajo said he decided to resign "in the interest of the Somali people."
Farmajo's ouster is part of a U.N.-backed deal signed in Uganda extending the mandate of Somalia's president, Sheikh Sharif Ahmed, and his speaker and deputies to August 2012.
"Considering the interest of the Somali people and the current situation in Somalia, I have decided to leave my office," Farmajo said. "I would like to thank my Cabinet who have done a lot to help improve security and standards of governance in Somalia."
The United States considers Somalia a haven for al-Qaida militants in East Africa and it has launched several airstrikes to kill them, the BBC said.
The country hasn't had an effective central government since the fall of the Siad Bare regime in 1991, the BBC said.