(CNN) -- Somalia's prime minister resigned Tuesday after a month of disagreements with the country's president.
Omar Abdirashid Sharmarke, the prime minister, told reporters about the resignation during a brief statement.
"After considering the political crisis within the government and the worsening security in Somalia, I have decided to resign from my post as prime minister," Sharmarke told reporters inside villa Somalia, the residence of President Sheikh Sharif Ahmed.
Sharmarke and Sharif have clashed over a number of issues including a new constitution for Somalia.
The president was present during the Sharmarke's speech and said he welcomed the resignation.
The resignation comes as violence continued in Mogadishu.
In the latest incident, a lone gunman tried to force his way into the presidential palace Monday night, according to the director of communication of the president, Abdirashid Khalif.
The gunman, who had a grenade and a rifle, was shot dead by security guards, Khalif said.
Journalist Mohamed Amiin Adow contributed to this report