A meeting over Venezuela-Colombia border tension has ended with an agreement by the countries' presidents to gradually normalise relations.
Monday's meeting in Ecuador came a month after the border was closed and trade and movement were paralysed.
After four hours of negotiations, Ecuador's President Rafael Correa read out a joint statement with seven points agreed on, starting with the immediate reinstatement of ambassadors.
The agreement also included a joint investigation of the situation at the border and the gradual opening of border crossings.
The diplomatic crisis began when President Nicolas Maduro deported about 1,500 Colombian migrants he blamed for the smuggling that has helped empty Venezuelan supermarket shelves.
Another 16,000 Colombians, some of whom have lived in Venezuela for years, fled voluntarily, fearing reprisals from Venezuelan troops who were seen bulldozing homes and forcing residents to flee across a river separating the two countries.
Although the deportation and mass exodus of Colombians have ceased, Maduro and his Colombian counterpart, Juan Manuel Santos, have only sharpened their attacks, with communities on both sides of the border suffering from the closure of all land crossings along a border five times the size of the one separating France and Germany.
Maduro accuses Santos of being complicit in an alleged plan hatched by right-wing elements in Colombia and the US to overthrow his government.
Monday's meeting was brokered by Correa, a close ally of Venezuela, and Uruguay's President Tabare Vazquez, the current rotating head of the 12-member Union of South American Nations.
Maduro and Santos spoke briefly in a joint news conference.
The Venezuelan president said the agreement was "the triumph of good judgement", while Santos said he was happy to re-establish dialogue with Venezuela.
There was no mention of the fate of the deported families.
Source: Al Jazeera and agencies