Ivory Coast is entering a highly dangerous phase.
The use of poorly trained but deadly militias by both sides in the war - and question marks over exactly which forces back Alassane Ouattara - make the future highly uncertain.
Perhaps Ivory Coast will return, in a few years' time, to being a relatively successful economic centre for West Africa.
But perhaps the model to be followed will be here in neighbouring Liberia - where a decade of violent ethnic balkanisation is only now beginning to be resolved.
The coming days and months are likely to be perilous for civilians as possible reprisal attacks take place.
The massacre at Duekoue in the west - where some people were savagely attacked while being burned alive as crowds looked on - was appalling in itself. But it was also a wider warning.
The United Nations is investigating who was responsible for the deaths of at least 160 (and maybe many more) people in Duekoue.
The killings began just hours after the Republican Forces, loyal to Mr Ouattara, swept through on their advance south towards Abidjan.
'Being a foreigner'
On the political front, when Mr Ouattara formally takes office, he will face continued opposition. This may include a possible crisis of legitimacy because, in some Ivorian eyes, he was helped to power by foreign military forces.
The French ambassador has told the AFP news agency that Mr Gbagbo was seized from his official residence by Mr Ouattara's forces but my understanding is that French forces led the operation.
It is hard to know the exact truth of who carried out the arrest but it is very significant.
If Mr Ouattara is perceived as having been put in power by the French, he will have difficulty governing the country, as nationalists will say he is a puppet of the outside world.
In any case, UN and French forces carried out air strikes against pro-Gbagbo positions during the last days of the siege.
Given Ivory Coast's long history of political and ethnic tension, it may not be enough for Mr Ouattara to have won the election and be "the internationally recognised" president.
Indeed, this international seal of approval may be a disadvantage in local political terms.
For almost 20 years Mr Ouattara's political opponents have accused him of being a "foreigner".
He hails from the mainly Muslim north.
But southern politicians have long sought to exclude him from power by saying part of his family is in fact from neighbouring Burkina Faso.
This nationalistic accusation has been very effective in the south even if in the north - and in many urban centres nationwide - Mr Ouattara won a majority of votes in last November's elections.
When the northerner Mr Ouattara formally takes the sash of office he will face enormous challenges. These include:
- explaining why he resorted to using militias known as "dozos" - when he had just a few weeks earlier made a speech, while holed up in the Golf Hotel, calling for new professional, "Republican" armed forces
- convincing radical nationalists in the south that he has not been foisted on them by a conspiracy of foreigners. This was the accusation consistently made by Mr Gbagbo - whether it is true or not it has been an effective political tool
- controlling all of the military forces that nominally backed him. It is known that some of the commanders who swept southwards are not part of the formal army officer corps. Some are known on occasions to have disobeyed senior officers' orders - but to have nevertheless retained their power bases
- finding a role for the "invisible commandos". Weeks before the main force swept south, these men conquered a large swathe of Abidjan. They were certainly fighting against Mr Gbagbo. But some of them are reported to have denied they are pro-Ouattara
- deciding which crimes committed during the fighting should be investigated and prosecuted. Duekoue is just the latest, albeit most shocking example
- some 500 people were killed or "disappeared" in the months before the big offensive. Most of the known cases were killed by Mr Gbagbo's army and militia. But some of the officers in charge subsequently defected to Mr Ouattara's side. Whether they should be rewarded with jobs in the Republican Forces or taken to court will be a complex political calculation.
Alassane Ouattara has a reputation as a rigorous, hard-working man.
As an assistant managing director of the International Monetary Fund (IMF) in the 1980s, and as prime minister of Ivory Coast in the early 1990s, he projected an urbane, highly professional image.
He's relaxed around conference tables, in formal ceremonies and while giving speeches.
But this war has thrust him into a world of fighters who wear coils of ammunition around their shoulders and bandanas on their heads.
When he takes power he may try to distance himself from the men of violence, even while praising their role, in his words, in "restoring democracy to Ivory Coast".
It's a political tightrope that Alassane Ouattara hasn't walked before.
He may have been elected to office. But in the end he only will have come to power finally through the use of local and foreign force.
It's all a long way from the boardrooms of the IMF; Mr Ouattara faces a steep learning curve if he is to survive this new world.