The top Ecowas mediator, Burkina Faso's President Blaise Compaore, told the meeting of politicians, religious and trade union leaders that a new government must "confront the terrorist peril in the north".
Ecowas chairman Alassane Ouattara, the president of Cote d'Ivoire, told the meeting - also attended by leaders of Niger, Togo, Benin and Nigeria - that "we cannot tolerate the partition of a brother country".
At the end of the summit, the leaders called for the International Criminal Court to investigate "war crimes" in northern Mali.
"They are asking the International Criminal Court to proceed with necessary investigations to identify those responsible for war crimes and to take the necessary action against them," a statement said.
The group also called on Mali to build a national unity government by July 31 that could "implement a roadmap to end the crisis".
And they asked "all parties taking part in the crisis for a complete end to hostilities before the month of Ramadan".
A summit source added that if a national unity government was not in place by the end of July, Ecowas would no longer recognise the government of Mali and the country could be suspended from sub-regional groups.
The meeting took place in the absence of Mali's interim president Dioncounda Traore, who has been receiving medical treatment in Paris since he was attacked by a mob in his office in May.
Also absent was Mali's prime minister, Cheikh Modibo Diarra, whose relations with Ecowas have been strained.
Representatives from Mali's north walked out just before the opening of the meeting, for unknown reasons.
Mali's renegade soldiers, after the March coup, agreed under intense regional and international pressure to hand power back to a civilian administration but have retained considerable influence.
The Popular Movement of March 22, which supports the coup, staged a protest rally in Bamako of "patriotic" groups against the Ecowas meeting. Organisers said 500 rallied while police put the figure at 250.
"This meeting is a protest against the meeting organized by Ecowas," a rally organiser, Nouhoum Keita said, stressing that the people of Mali alone must create a national unity government.
Keita said a national convention would be held July 14-16.
The coup - which soldiers justified by saying they were too poorly equipped to fight the northern rebels - has left Mali effectively split in two, with Islamist controlling an area larger than France or Texas.
The UN Security Council in a resolution Thursday expressed "deep concern" at the presence of Al-Qaeda in the Islamic Maghreb fighters, who have been blamed for kidnappings and attacks in several countries.
But the council held back from giving a UN mandate to any West African force that could help Mali's interim government take back the territory.