The M23 rebel group in the eastern Democratic Republic of Congo says it is ending its insurgency, hours after the government claimed military victory.
In a statement, the movement said it would adopt "purely political means" to achieve its goals and urged its fighters to disarm and demobilise.
The government said the last remaining rebels had either surrendered or fled the country overnight.
The army says it will now pursue other rebel groups that do not disarm.
At least 800,000 people have fled their homes since the M23 took up arms in 2012 but several other armed groups still operate in the mineral-rich eastern DR Congo.
M23 leader Bertrand Bisimwa announced on Tuesday that "the chief of general staff and the commanders of all major units are requested to prepare troops for disarmament, demobilisation and reintegration on terms to be agreed with the government of Congo".
His decision to pursue its aims by political means was posted on a Facebook page linked to the group.
Although the statement came after an apparently heavy military defeat, it also followed an agreement by African leaders on Monday night that the M23 should make "a public declaration renouncing rebellion" to allow a peace accord to be signed with the Congolese government.
Congolese Defence Minister Alexandre Luba Ntambo, after the summit in the South African capital Pretoria, said once the rebels had publicly abandoned their insurgency the government "would make a public declaration of acceptance of this". Five days later, a formal peace agreement would be signed, he added.
The BBC's Milton Nkosi in South Africa says, with its announcement on Tuesday, the M23 appears to have met the conditions of the African leaders.
While Ugandan President Yoweri Museveni was at the summit, Rwanda's Paul Kagame was conspicuous by his absence, our correspondent says. Rwanda's foreign minister was at the meeting, however.
The UN has regularly accused Rwanda and Uganda of supporting the M23, although both governments deny the allegation.
The US and other donors have cut aid to Rwanda over the allegations.
DR Congo Information Minister Lambert Mende said on Tuesday that Congolese special forces had driven the rebels out of their final hilltop strongholds near the Ugandan border.
Tanks and helicopters from a UN intervention brigade with a tough new mandate to "neutralise" rebel groups approved earlier this year have also been involved in recent fighting.
"We can say that it's finished. But you never know," Mr Mende told the BBC's Newsday programme. "Those who escaped can come with hit-and-run operations so we have to end everything politically so that we are sure our people can sleep quietly without any threat."
Rebel military chief Sultani Makenga was among those who had crossed the border either to Rwanda or Uganda, he added.
Army spokesman Colonel Olivier Hamuli said it was "a victory for the Congolese people" but it was now important to sue for peace.
"We now speak to other armed groups to surrender because if they don't want to, then we will disarm them by force," the army spokesman told the BBC.
A number of rebel factions operate in the two eastern provinces of North and South Kivu.
The information minister also warned that other rebel groups would now be targeted by the army. "There is no more place in our country for any irregular group," Mr Mende told AFP news agency.
The M23, made up mainly of ethnic Tutsis, had now been replaced as "top of the list" by the Rwandan Hutu FDLR militia, he said. "We are going to get on with disarming them."
Rwanda's Tutsi-led government has twice invaded DR Congo, saying it wanted to stop Hutu groups, such as the FDLR, from attacking its territory.
Analysts say that if the FDLR were defeated, this would remove Rwanda's main justification for its involvement in Congolese affairs, although it denies backing the M23.
US special envoy Russell Feingold told reporters in Pretoria the M23's announcement was "a significant, positive step". Rebels should be protected when they had disarmed, he said, but those guilty of serious crimes should not be given an amnesty.
Peace talks broke down in October in the Ugandan capital, Kampala, following two months of negotiations.
The Congolese army began a big offensive against rebel positions on 25 October, securing their last major stronghold at Bunagana on the Ugandan border last week.
The M23, made up of army deserters, was named after a 23 March 2009 peace deal signed by the government and a former militia.
The rebels accused the government of failing to live up to the terms of the agreement and took up arms in April 2012, at one point seizing the regional capital, Goma.
Earlier this year, heavy fighting broke out between rebel factions of the M23 which led to one of its leaders, Bosco Ntaganda, fleeing to the US embassy in Rwanda. The former Congolese army general, known as "the Terminator", then surrendered to the International Criminal Court to face trial in The Hague on war crimes charges.
The end of the M23 would send an intimidating message to the other groups, raising hopes of an end to two decades of conflict, BBC Africa security correspondent Moses Rono says.
Eastern DR Congo has been wracked by conflict since 1994, when Hutu militias fled across the border from Rwanda after carrying out a genocide against Tutsis and moderate Hutus.