CARACAS, Venezuela — Former Venezuelan presidential candidate Edmundo González arrived Sunday in Spain after fleeing into exile in a negotiated deal with President Nicolas Maduro’s government that dealt a major blow to millions who placed their hopes in his opposition campaign.

The surprise departure of the man considered by Venezuela’s opposition and several foreign governments to be the legitimate winner of July 28 presidential election was announced late Saturday by Venezuelan officials who ordered his arrest just a few days ago.

González, 75, landed at a military airport near Madrid, accompanied by his wife and Spanish officials, Spain’s foreign ministry said.

Opposition leader Maria Corina Machado tried to put a positive spin on his departure, assuring Venezuelans that the retired diplomat would be back on Jan. 10 for a swearing-in ceremony marking the start of the next presidential term.

“His life was in danger, and the increasing threats, summons, arrest warrants and even attempts at blackmail and coercion to which he has been subjected, demonstrate that the regime has no scruples,” Machado said on X. “Let this be very clear to everyone: Edmundo will fight from outside alongside our diaspora.”

But on the streets of Caracas the mood was one of despair at the loss of someone who, against the odds, reignited a movement to end more than two decades of single-party rule.

“What little hope we had left, it went with him,” Laura Vargas said as she scrolled through the news on her cellphone while sitting on a park bench.

González joins the swelling ranks of opposition stalwarts who fought Maduro, only to throw in the towel and seek asylum abroad in the face of a brutal crackdown. In Spain, he joins at least four former presidential hopefuls who were imprisoned or faced arrest for defying Maduro’s rule.

Ever since the vote, he and Machado have been in hiding as security forces rounded up more than 2,000 people, many of them young Venezuelans who spontaneously took to the streets to protest Maduro’s alleged theft of the election.

Venezuelan officials have yet to comment. However, Vice President Delcy Rodríguez said in a statement late Saturday that the government decided to grant González safe passage out of the country to help restore “the country’s political peace and tranquility.”

Spain’s center-left government said the decision to leave Venezuela was González’s alone, and he departed on a plane sent by the country’s air force. González originally sought refuge in the Dutch ambassador’s residence in Caracas, the Netherlands’ government said Sunday, and later transferred to Spain’s diplomatic mission as the terms of his exit were negotiated in secret.

Spanish Foreign Minister José Manuel Albares told Spanish broadcaster RTVE that his government will grant González political asylum as he requested.

“Of course, I told him we were pleased that he is well and on his way to Spain, and I reiterated the commitment of our government to the political rights of all Venezuelans,” Albares said en route to China with Prime Minister Pedro Sánchez for a state visit.

The European Union’s foreign affairs chief, Josep Borrell, a former Spanish foreign minister, described González’s departure as “a sad day for democracy in Venezuela.”

Referring to González as the apparent winner of the presidential elections, Borrell said the “EU will maintain its support of the Venezuelan people in their democratic aspirations.”

González was a last-minute stand-in after Machado was banned from running. Previously unknown to most Venezuelans, he nonetheless rapidly galvanized the hopes of millions of Venezuelans desperate for change after a decadelong economic free fall.

While Maduro was declared the winner of the July vote, most Western governments, including Spain, have yet to recognize his victory and are instead demanding that authorities publish a breakdown of votes.

Tally sheets collected by opposition volunteers from over two-thirds of the electronic voting machines indicate that González won by a more than 2-to-1 margin.

The tally sheets have long been considered the ultimate proof of election results in Venezuela. In previous presidential elections, the National Electoral Council published online the results of each of the more than 30,000 voting machines. But the Maduro-controlled panel did not release any data this time, blaming an alleged cyberattack mounted by opponents from North Macedonia.

Experts determined that the results announced by electoral authorities lacked credibility.