An African Union peacekeeper has been killed and another one injured by a roadside bomb in the Somali capital.
It comes days after the AU warned it may have no option but to leave Somalia unless its force was bolstered.
Ethiopia has begun withdrawing its 3,000-strong force from Somalia, two years after it helped the interim government oust Islamists in power.
In a separate attack, a man working for the UN was killed by three masked gunmen in south-west Gedo region.
Ethiopia's departure follows an agreement with the Somali transitional government and the more moderate wing of the Islamist-led political opposition during UN-sponsored reconciliation talks in Djibouti.
But government forces only control parts of capital, Mogadishu, and the town of Baidoa.
While Islamist and nationalist insurgents have vowed to overthrow what remains of the government, whose president resigned last month.
Battles with al-Shabab
The 3,600-strong AU force has faced frequent attacks from Islamist insurgents - especially the al-Shabab group - in the capital, Mogadishu.
The latest attack brings the number of AU troops killed in Somalia to nine, since the first Ugandan troops were deployed there in 2007.
A spokesman for the AU force said the incident took place on the outskirts of Mogadishu, when a convoy of peacekeepers was hit by an improvised explosive device.
The shooting in Gedo took place on Tuesday while Ibrahim Hussein Duale was monitoring a school feeding in a World Food Programme-supported school in Yubsan village.
Witnesses say the gunmen approached him while he was seated, ordered him to stand up and then shot him, the UN said in a statement.
The leader of a pro-government militia fighting al-Shabab in Gedo, Barre Hiraale, told the BBC's Somali Service that al-Shabab was behind the attack.
Mr Hiraale is a member of parliament and former warlord of Kismayo where he was ousted by al-Shabab fighters earlier this year.
On Tuesday his fighters took the town of Bardhere in Gedo from al-Shabab and fighting has been reported in neighbouring Bai region, considered one of the main bases for al-Shabab.
Observers say Mr Hiraale is being armed by the withdrawing Ethiopian troops, an allegation he denies.
Over the last year fighting has displaced roughly half of Mogadishu's population and half the country is dependent on food aid.
Somalia has not had a functioning government since 1991 and in that time thousands have also fled to neighbouring Kenya.
Thousands of refugees have fled to neighbouring Kenya
Meanwhile, the UN's refugee agency has come in for criticism for saying recently that Somalis fleeing the civil war would be better off staying with relatives as the agency had no space in the main camp just over the border.
Dadaab camp on Kenya's eastern frontier with Somalia was designed for 90-000 refugees, but is now struggling to cope with three times that number, and hundreds more arrive every day.
The BBC's Peter Greste in Nairobi says that last year, more than 60,000 turned up at the gates after sneaking or bribing their way through the border that has been officially closed for most of the past two years.
But according to Judy Wakahiu of the Refugee Consortium of Kenya, not accepting refugees amounts to an abrogation of the UNHCR's responsibilities.
"I don't think its right to do that because according to the mandate of the UNHCR, they are supposed to receive and protect refugees regardless of the number," she told the BBC.
Kenya's immigration minister has admitted keeping the border closed has created problems, but has insisted that national security comes first.
Our reporter says the government has been negotiating with local communities for the past two years to acquire land for another camp near the border, but so far those communities have remained hostile.