Rwanda''s President Paul Kagame and Uganda''s Yoweri Museveni were once close allies but their relations have turned deeply hostile in a dispute that damaged trade between the east African neighbours.
Rwanda abruptly closed the border with its northern neighbour in late February, severing a major economic land route.
In May, Ugandan police accused Rwandan soldiers of entering the country and killing two men, drawing an angry denial from Kigali.
On Wednesday, the two leaders agreed to respect each other''s sovereignty and that "of the neighbouring countries", according to a statement issued after the signing.
They undertook to "refrain from actions conducive to destabilisation or subversion in the territory of the other party (and) acts such as the financing, training and infiltration of destabilising forces".
The two leaders also agreed to "protect and respect the rights and freedoms" of people "residing or transiting" through their respective countries and to resume cross-border activities "including movement of persons and goods... as soon as possible".
After the signing, Kagame said he did not anticipate any problems in working "more specifically with President Museveni to address what we have agreed to address".
"It may take a bit of time to understand each other but I think we have come a long way," Kagame told a news conference.
"We are going to address all these problems... indiscriminately," he said, adding: "We are not going to be found wanting."
For his part, Museveni said: "Uganda is fully committed to enforcing this agreement" which is set "to improve the political and economic relations between our countries".
"We have agreed on a raft of issues... largely meant to improve our security, trade and political relations," he said.
Heads of state including Angolan President Joao Lourenco, the Democratic Republic of Congo''s Felix Tshisekedi -- who facilitated the talks -- as well as Congo''s Denis Sassou Nguesso witnessed the signing in the Angolan capital Luanda.
Left unresolved, the row between the two leaders would risk dragging in their neighbours, threatening economic integration and regional stability in an already conflict-prone swathe of the continent.
The standoff escalated dramatically in March when Rwanda publicly accused Uganda of abducting its citizens and supporting rebels bent on overthrowing the government.
Apart from a brief interlude in June the frontier has remained shut, damaging the economies of both countries reliant on cross-border trade.
Museveni -- who has admitted meeting, but not endorsing, anti-Kagame rebels -- harbours his own suspicions about his erstwhile ally. His officials have accused Rwandans in Uganda of spying, and some have been detained or deported. RCJ
Disclaimer :- This story has not been edited by Outlook staff and is auto-generated from news agency feeds.