I don't understand why people want to stay so long, especially when they have got a lot money,"
Barack Obama told African nations on Tuesday they needed to respect democratic rules and create jobs to avoid a slide into disorder.
In the first speech by a serving U.S. president to the 54-nation African Union, he said violence unleashed in Burundi by the president's bid for a third term in office showed the risks of ignoring constitutional rules.
"Africa is on the move, and a new Africa is emerging," he said at the AU headquarters in Addis Ababa, adding the continent's rapid economic growth was changing "old stereotypes" of a continent of war and poverty.
But he said there was an "urgent task" facing a continent whose 1 billion people will double in a few decades.
"Africa will need to generate millions more jobs than it is doing now," he said. "We need only look to the Middle East and North Africa to see that large numbers of young people with no jobs and stifled voices can fuel instability and disorder."
"Africa’s progress will also depend on democracy," he said, adding that jailing journalists or restricting legitimate opposition groups led to "democracy in name, but not in substance".
Obama said leaders should stick to the rules and the African Union should put pressure on leaders to stick to limits.
"I don't understand why people want to stay so long, especially when they have got a lot money," Obama said, drawing laughter from an audience on a continent often known for politics of "Big Men" accused of siphoning off state funds.
Noting that he was in his second term and could not serve again, even though he thought he could win a vote, Obama said: "I’m looking forward to life after being president."
Obama's speech wound up a tour of Kenya, his father's homeland, and Ethiopia, a once famine-stricken nation which is on course to deliver 10 percent growth this year.
Throughout his trip, he has spoken of security cooperation with states battling Islamist militants in Somalia, democratic development and trade with a continent, which since 2009 has done more trade with China than America.
In an apparent swipe at China, without mentioning any country, he said the United States offered a partnership that "can’t simply be about building countries’ infrastructure with foreign labour or extracting Africa’s natural resources".
China has built huge amounts of infrastructure across Africa, including a new metro snaking across Addis Ababa.
But Africans have increasingly accused Chinese firms of using expatriate labour and sucking out commodities without adding value. China insists it is also a partner in development.
While in Ethiopia, Obama held talks with regional African leaders on the conflict in South Sudan. The U.S. president called for tougher measures against the world's newest nation if its warring factions failed to reach a peace deal by Aug. 17.
He repeated that threat in his speech, while also calling on leaders of the Central African Republic, another nation struggling with conflict, to respect elections later this year.