Congress formally ratified a revised peace agreement with Colombia’s biggest leftist rebel group, capping a torturous four years of negotiations, a stunning referendum rejection, last-minute compromises and two signing ceremonies.

The initial pact was narrowly rejected by voters last month, and President Juan Manuel Santos decided to skip a referendum on the new version and go directly to congress, where the deal’s supporters hold a majority. Opponents, led by former President Alvaro Uribe, boycotted the legislative votes, which resulted in unanimous approval by the Senate on Tuesday and by the lower house late Wednesday.