(CNN) -- Not too long ago, the African stage belonged to Moammar Gadhafi.
In flowing robes and wraparound sunglasses, he crisscrossed the continent in flashy caravans as throngs of supporters waved and cheered from the roadsides.
Fellow African leaders bestowed upon him endearing nicknames: "brother leader," "king of kings of Africa."
And Libya was among the African Union's largest contributors, paying dues for some of the 54 member nations.
But Gadhafi's regime now sits in ruins, leaving sub-Saharan Africa without a major investor who disbursed billions of dollars for roads, mosques and luxury hotels.
"He was known for handing out large sums of cash. Wherever he thinks he can buy friendship, he hands out large sums of cash," said Richard Dowden, executive director of the Royal African Society, a London-based group that aims to foster a better understanding of the continent.
"His investments bought him loyalty. It's a very African thing to do: 'He helped us, so let's help him'"
In Niger, which has given refuge to his son, Saadi Gadhafi, the ousted leader's influence is evident.
A gleaming mosque built by the Libyan government in the 1970s stands tall in the capital of Niamey. Thousands attend prayers at the mosque -- a valuable gift to the poor Muslim country where crowds pack into limited worship spaces.
Next door in Mali, Gadhafi funded the construction of a popular mosque in the capital Bamako, and helped pay for a Malian government complex that's under construction.
Gadhafi also poured money into neighboring Chad and Burkina Faso as well.
Such investments sealed Gadhafi's clout in sub-Saharan Africa. It came as no surprise that some leaders were initially reluctant to endorse the new Libyan interim government, analysts say.
"Whoever ... builds infrastructure, provides cheap products for markets and loans to support government initiatives will always have an influence over Africa affairs," said Ayo Johnson, director of Viewpoint Africa, an organization that sells content about Africa to media outlets internationally.
Another reason many in the continent backed Gadhafi was self-preservation, analysts say.
"Some African leaders think that if they don't support Gadhafi now, next time round it could be them and who will take them in?" Johnson said. "This move guarantees some protection should there be an uprising in their countries ... they can count on each other."
For their part, some continent leaders say they did not rush to recognize the new Libyan leadership because the international community overstepped its boundaries.
South African President Jacob Zuma, who joined the African Union in recognizing the new leadership last month, said NATO's military intervention in Libya undermined efforts by the pan-African body to find peaceful solutions for member states.
In Africa, Gadhafi's influence extended beyond his generosity. His ideas and eccentricity were also a big draw, analysts say.
During his term as chairman of the African Union in 2009, he renewed his calls for a "United States of Africa" that would use a single passport, a single military and a single currency.
He had proposed a similar concept for Arab unity, but was rebuffed.
"The Arab world did not like him, and he had no choice because they were not as easy to push around," said Abdul Raufu Mustapha, a professor of African politics at Oxford University. "He turned to sub-Saharan Africa... They had a lot of struggling nations"
So, while some sub-Saharan African leaders considered Gadhafi's vision of a unified Africa unrealistic, they nevertheless hailed it as one advocating pan-African cooperation.
"He sang the liberation song very well, and a lot of people connected with that because that still strikes a chord," Dowden said.
Also propelling Gadhafi's popularity in the region: his anti-Western tirades.
"Both Gadhafi and Zimbabwe's Robert Mugabe dare to stand up against the West ... they are seen as Africa bad boys and wear their medals with pride," Johnson said. "He who stands up and shouts the most is usually revered."
Johnson described Gadhafi as "the rogue school bully" who, despite the fact that his actions may not be condoned, commands respect for challenging the status quo.
And there were plenty of Gadhafi investments that were condemnable, analysts say.
His support of brutal dictators, such as former strongman Charles Taylor of Liberia, helped intensify the bloodshed in the region, Dowden said.
Taylor, who led Liberia from 1997 to 2003, is accused of fueling a bloody civil war in his nation and neighboring Sierra Leone that led to widespread murder, rape and mutilation.
Gadhafi is also accused of helping arm Arab militias in Sudan's violence-wracked Darfur region. And he backed rebel groups in several countries including the Tuaregs in Mali and Niger, who were responsible for violence in the 1990s. The new Libyan government has said it believes the Tuareg tribe is currently protecting the fallen leader.
"Gadhafi supported a lot of West African revolutions that led to a lot of bloodshed and civil wars," Dowden said. "He funded and helped create those revolutions."
During Libya's civil war, the gambit paid off. As rebel forces advanced, seizing town after town, Gadhafi called in fighters from non-Arab nations for backup, analysts say.
Some fighters are from countries "beholden to him" and those fleeing the grinding poverty in their homelands, Mustapha said.
On the other hand, Gadhafi also financially supported the African National Congress in its fight to end apartheid in South Africa, according to Dowden.
"Even while he was funding rebels, he was also funding liberation movements. We cannot take that from him," Dowden said.
This dichotomy makes Gadhafi's legacy in the continent a tricky one, analysts say.
"Whoever writes the final chapter will have a difficult balancing act with a man who has a complex schizophrenic relationship with the world," Johnson said. "Love him or hate him. Madman or god?"
So what awaits Africa now that Gadhafi is no longer in power?
"There are two big elephants in the room," said Robert Taiwo, director of Whitespace Advisory, a global firm that works with companies looking to invest in Africa.
Will Gadhafi's absence lead to gaps in infrastructure investment in some of the countries? And if so, how will those countries cope?
"According to the World Bank, the infrastructure funding gap in Africa is approximately $31 billion per year. It also appears that Gadhafi has invested in some of the poorest and most fragile regions in Africa," Taiwo said.
In the long run, the international community may have to step in to fill the gaps, he said.
But for now, the ripple effects are already reverberating.
In Niger, long a recipient of Gadhafi's largesse, a road funded by the ousted leader lies unfinished.
CNN's Nic Robertson contributed to this report from Niamey, Niger