FILE - In this Jan. 5, 2019, file photo, Venezuelan lawmaker Juan Guaido takes the oath of office as president of the National Assembly in Caracas, Venezuela. A coalition of Latin American governments that joined the U.S. in quickly recognizing Guaido as Venezuela’s interim president, and not Nicolas Maduro, came together during weeks of secret diplomacy. (AP Photo/Fernando Llano, File)

FILE - In this Jan. 5, 2019, file photo, Venezuelan lawmaker Juan Guaido takes the oath of office as president of the National Assembly in Caracas, Venezuela. A coalition of Latin American governments that joined the U.S. in quickly recognizing Guaido as Venezuela’s interim president, and not Nicolas Maduro, came together during weeks of secret diplomacy. (AP Photo/Fernando Llano, File)

CARACAS, Venezuela (AP) — The coalition of Latin American governments that joined the U.S. in quickly recognizing Juan Guaido as Venezuela’s interim president came together over weeks of secret diplomacy that included whispered messages to activists under constant surveillance and a high-risk foreign trip by the opposition leader challenging President Nicolas Maduro for power, those involved in the talks said.

In mid-December, Guaido quietly traveled to Washington, Colombia and Brazil to brief officials on the opposition’s strategy of mass demonstrations to coincide with Maduro’s expected swearing-in for a second term on Jan. 10 in the face of widespread international condemnation, according to exiled former Caracas Mayor Antonio Ledezma, an ally.

ADVERTISEMENT

To leave Venezuela, he sneaked across the lawless border with Colombia, so as not to raise suspicions among immigration officials who sometimes harass opposition figures at the airport and bar them from traveling abroad, said a different anti-government leader, speaking on condition of anonymity to discuss security arrangements.

Building consensus in the fragmented anti-government coalition proved to be an uphill battle. The opposition has for years been divided by egos and strategy, as well as a government crackdown that has sent several prominent leaders into exile, making face-to-face meetings impossible. Others inside Venezuela were being heavily watched by intelligence agencies, and all were concerned about tipping off the government.

Long sessions of encrypted text messaging became the norm, the opposition leader said. A U.S. official said intermediaries were used to deliver messages to Guaido’s political mentor and opposition power broker Leopoldo Lopez, who is under house arrest after he tried and failed to lead a mass uprising against Maduro in 2014. The U.S. official spoke on condition of anonymity out of security concerns.

Despite Guaido’s personal assurances in Bogota that he would declare himself interim president at a Jan. 23 rally coinciding with the anniversary of the 1958 coup that ended Venezuela’s military dictatorship, the suspense lasted until the hours before the announcement, said a Latin American diplomat from the Lima Group who requested anonymity because he was not authorized to speak to the media. Some moderate factions were left in the dark or wanted to go slower, worrying that a bold move would lead to another failure for the opposition. In the end, those differences were smoothed over internally, without any public discord.

ADVERTISEMENT

“This is the first time in at least five years the opposition has shown an ability to come together in any meaningful manner,” said a senior Canadian official who spoke on the condition of anonymity because he was not authorized to talk publicly.

The decision to confront Maduro directly was only possible because of strong support from the Trump administration, which led a chorus of mostly conservative Latin American governments that immediately recognized Guaido.

It was no small diplomatic feat, comparable in recent times only to how the hemisphere in 1994 rallied behind Jean Bertrand Aristide to bring him back to power in Haiti after we was deposed in a coup, given the mistrust of the U.S. in Latin America stemming from U.S. military interventions in the region during the Cold War. Just as impressive, the tough-handed approach drew bipartisan support, with two of the Senate’s most senior Democrats, Dick Durbin and Bob Menendez, offering praise.

The watershed moment was President Donald Trump’s stunning remark in August 2017 from the steps of his New Jersey golf club that a “military option” was on the table to deal with the Venezuelan crisis.

In the weeks that followed, Trump went on to strongly condemn Maduro in his address to the U.N. General Assembly as well as quietly press aides and some Latin American leaders about a military invasion of the country.

From then on, countries in the region realized they had a partner in the U.S. willing to tackle a crisis that had been years in the making but which previous U.S. administrations had chosen to play down because of limited national security implications, said Fernando Cutz, a former senior national security adviser on Latin America to both President Barack Obama and Trump.

For some, especially Mexico, which was renegotiating NAFTA, adopting a more aggressive stance was also an opportunity to gain leverage in bilateral relations with the Trump administration.

“Trump has personally sparked a lot of this,” said Cutz, now with the Cohen Group, a Washington consulting firm. “Literally in every interaction that he has had with Latin American leaders since taking office, he brings up Venezuela. That has forced a lot of hands.”

On Jan. 4 — a day before Guaido was sworn in as national assembly president — foreign ministers from 13 nations of the Lima Group, which doesn’t include the U.S., said they wouldn’t recognize Maduro’s second term.

That set off a scramble at the White House to make sure it wasn’t being left behind, said a former U.S. official and congressional staffer who was in close contact with the national security council. Both spoke on the condition of anonymity because they weren’t authorized to discuss the administration’s planning.

Playing a key role behind the scenes was Lima Group member Canada, whose Foreign Minister Chrystia Freeland spoke to Guaido the night before Maduro’s searing-in ceremony to offer her government’s support should he confront the socialist leader, the Canadian official said. Also active was Colombia, which shares a border with Venezuela and has received more than 2 million migrants fleeing economic chaos, along with Peru and Brazil’s new far-right President Jair Bolsonaro.

___

Gillies reported from Toronto and Alonso reported from Washington. Associated Press writer Anna Jean Kaiser in Sao Paulo, Brazil, contributed.

___

Follow Joshua Goodman on Twitter: https://twitter.com/APjoshgoodman

___

Follow Luis Alonso Lugo on Twitter: twitter.com/luisalonsolugo