When the famine was declared in Somalia nearly a year ago, there was a huge international outcry. It was the second time in two decades the nation had experienced a severe drought. But, unlike the one in the early 1990s, Somalia was now the subject of the so-called "war on terror".
Somali pirates have caught the world's attention but inland, a year on, there is still hunger, although no longer famine. In the week the UAE hosted its second international counter-piracy conference, there are lessons from last year's famine on how to win hearts and minds.
Then, Al Shabab, an Islamist group linked to Al Qaeda, controlled large parts of the country, including the famine-declared regions.
It was not feasible for the US, the biggest donor, to deal with Al Shabab, which it designates as a terrorist group. The US decided its aid would not be used in the Al Shabab-held famine zones. For its part, Al Shabab would not accept assistance from the enemy.
Immediately, the arguments over access began and Al Shabab was blamed for "refusing access to relief agencies that want to feed the hungry".
But there was a hidden agenda. Several aid workers told me that the West, especially America, regarded the famine as a crucial opportunity to defeat Al Shabab.
Washington believed that Al Shabab was incapable of feeding millions of drought victims and therefore expected people to turn against the Islamists. In other words, the US was hoping that Somalis would say to Al Shabab: "Feed us, or leave us."
So the war was not only fought on the battlefield. Whoever could win the hearts and minds of the Somalis would win the war.
Western governments, their media outlets and some humanitarian agencies were following the same narrative: blame everything on Al Shabab. In fact, these groups needed to be more considerate to the starving civilians, who have nothing to do with the war between Al Qaeda and the West.
As a Somali journalist documenting the famine, I was saddened not only by the suffering of my people but how their desperate conditions were turned into a political tool.
For Al Shabab, it was an enormous challenge. If they were to maintain their local support, they had to feed millions of people without the support of rich nations. Large amounts of their war budget had to go towards feeding programmes. And spending money on weapons to fight against western-backed troops was no longer the top priority.
The Islamists set up a drought committee to deal with the crisis, eight months before the famine was declared. They established refugee camps and were collecting money from the rich and giving to the poor. The group's head of humanitarian affairs told me: "We are learning the hard way."
I was the first journalist to visit the famine-affected areas and I interviewed Al Shabab's spokesman.
Sheikh Ali Dhere dismissed the UN declaration of a famine. "The famine has been averted due to support and aid from business, the Somali communities and the Muslim community," he told me. "So there is no famine but there is a drought."
More importantly, Al Shabab cleverly exploited the competition within the aid community by banning those who were a threat to its reign while allowing others to operate. The UN's World Food Programme (WFP), which is the biggest food agency in the world, was thrown out.
Occasionally, Al Shabab followed the public mood and targeted the aid organisations that were unpopular in the country. Many Somalis suspect that the WFP is doing more harm than good by importing food from outside rather than encouraging local farming.
Corruption is also known to be rife within the UN agency. In 2009, I investigated the WFP operation in Somalia for Britain's Channel 4 News and revealed that thousands of sacks of food had been diverted from refugees and sold on the open market.
Following our report, the UN launched an inquiry that found that up to half of the food aid sent to Somalia was diverted from those in need to corrupt business leaders, militants and local UN officials. And even last year, at the height of the famine, there were reports of the misuse of aid.
The cosy relationship between western journalists and the aid community meant those banned by Al Shabab tried to pressure the militants through the media.
With no access to famine areas, most journalists were reporting from the Dadaab refugee camp in northeastern Kenya. There were reports of thousands of drought victims arriving in the camp on a daily basis.
I went to southern Somalia to meet some of the families making a perilous journey in a bid to help their families survive the drought. I began in the border town of Dobley, where families rest before pushing on to Kenya and the Dadaab refugee camp.
Talking to the residents and Kenyan officials in the border town of Liboi, it became apparent that the number was exaggerated. This was partly to get more funding but also to put more pressure on Al Shabab.
However, the West was too complacent, considering itself the only saviour.
In fact, Somalis outside the country organised themselves and raised millions. Money sent by them provided much-needed humanitarian assistance. For many years, the diaspora community have been making major contributions to the local economy and livelihoods through remittances.
During my trips to Somalia, I saw hundreds of Somalis from all over the world who came back to help their people. Some of them were not afraid to challenge Al Shabab.
And they were more pragmatic than foreign aid workers, who, though with good intentions, don't always understand the needs of the people.
Other countries stepped in. Turkey was an alternative to the West and played an important role.
Millions of Somalis were touched by the visit of Turkish Prime Minister Recep Tayyip Erdogan in August last year. He visited refugee camps and hospitals in Mogadishu to witness the devastation caused by the severe drought.
Mr Erdogan, who was accompanied on the trip by his family and four ministers, was the first non-African leader to visit the Somali capital in nearly two decades. Since Mr Erdogan's visit, the relationship between the two countries has gone from strength to strength. Turkish companies are now taking part in the public sector recovery by building hospitals and roads.
Earlier this year, Turkish Airlines became the first major international carrier to land at Mogadishu Airport in more than 20 years.
And this month, the Turkish government invited world leaders and hundreds of Somalis to Istanbul to discuss the future of the country.
Turkey is also encouraging the Muslim world, which has abandoned Somalia for many years, to take a more active role.
For Al Qaeda, the famine was an opportunity to recruit. On a visit to the sprawling Ala-Yasir camp in the south of the country, I witnessed men claiming to be Al Qaeda operatives moving into the humanitarian vacuum in Somalia.
They were distributing aid and cash to drought victims in an attempt to win hearts and minds.
Although Somalia is no longer a famine zone, the scars of last year's drought are still there.
But there is still hope for things to improve. Somalis have learnt who cares about them. Neither the West nor Al Shabab won the battle for hearts and minds: instead new actors like Turkey have shown the way. And I hope the world learns from them.
Jamal Osman is a Somali journalist and filmmaker. He has reported extensively from Somalia, including the regions controlled by Al Shabab. On Twitter: @jamalmosman