HAVANA (Reuters) - Tens of thousands of Cubans, some wrapped in red, white and blue national flags, paid final respects in Havana on Monday to Fidel Castro, who led a leftist revolution, ruled for half a century and resisted the United States throughout the Cold War.

Castro died on Friday at the age of 90, a decade after stepping down due to poor health and ceding power to his brother Raul Castro. While he had been retired as an active leader, his death removed any impediment on his brother to pursue deeper relations with Washington if U.S. President-elect Donald Trump warms to the idea of improved ties.

Castro was admired by leftists and people of the developing world who saw him as a revolutionary champion of the poor, but he was vilified by many who viewed him as a dictator who oppressed Cubans and ruined the economy through socialism.

“Long live Fidel! We can hear him, we can feel him, he’ll always be here,” a crowd gathered near Havana’s Revolution Square chanted, holding up a banner that read “We are Fidel”.

The government invited people to the square for a two-day commemoration that started with a 21-gun salute heard throughout much of the capital.

Thousands queued in snaking lines to walk past a portrait of a young Fidel dressed in military fatigues, with a rifle and pack slung over his back. Raul Castro and his top lieutenants held a separate, private ceremony, where they signed a book in front of an identical portrait, and laid white flowers.

While some world leaders have sent admiring messages of condolence, Castro has been condemned by critics, including Trump, who in a weekend statement called him “a brutal dictator who oppressed his own people.”

Before Castro’s death, Trump had threatened to reverse President Barack Obama’s rapprochement with Cuba, which has included restoring diplomatic ties, increasing trade and pressing the U.S. Congress to end years of economic embargo.

The Republican Trump, who takes office on Jan. 20, reiterated that on Monday, saying in a Twitter message he would end the U.S. “deal” with Cuba if the government in Havana did not reciprocate with “a better deal for the Cuban people.” He did not give details of what this might entail.

Castro was cremated on Saturday and the government has declared a nine-day period of mourning. His ashes will be carried in a cortege to a final resting place in Santiago de Cuba, the city in eastern Cuba where he launched the revolution.

While many Cubans have reported a certain pressure to attend the government’s many staged events and Castro was hated by many who fled for Miami, he was also widely loved and people appeared to shed genuine tears on Monday.

“I’m devastated because it’s as if my own father had died, he was like my second father. Everything we have, my education as a doctor, it’s thanks to him,” said Maria del Carmen, 57, who had been standing in line since before dawn, and who gave only her first name.

Some people arrived as early as 4 a.m. to be at the head of one of three lines of mourners entering a square that has been central to Cuba’s recent history, and where Castro gave many of his rousing, lengthy speeches.

Slideshow ( 15 images )

Among the mourners was Belkis Meireles, a 65-year-old civil engineer who arrived two hours before the start.

“I am very sad. I came to pay homage to our father, friend, commander,” Meireles said in a hushed voice. “He was a man who freed us and sent doctors and teachers everywhere around the world.”

Political opponents stayed away or kept quiet, allowing admirers to say goodbye to a man who elevated the island to the world stage during the Cold War by forging a communist-run state just 90 miles (145 km) from Florida and then resisting Washington’s long efforts to force change.

Slideshow ( 15 images )

“He wasn’t perfect. Nobody is,” said Roberto Videaux, a 72-year-old retiree who was nonetheless proud of Castro. “Fidel was a teacher, a patriot.”

OBAMA’S DETENTE THREATENED

After decades fighting what he termed the “empire to the north,” Castro was distrustful about the rapprochement his brother achieved with Obama, publicly expressing his reservations in columns published in the Communist Party newspaper.

Obama, a Democrat, began the opening to Washington’s old Cold War foe after he won his second term in office, and has brought about his policy change through executive actions, including allowing scheduled commercial airline flights.

A scheduled flight from the United States landed in Havana on Monday for the first time in more than 50 years: an American Airlines plane that made the hop from Miami. Scheduled service from U.S. airports to the Cuban provinces restarted in August.

The only Cuba-focused stock fund in the United States rallied more than 13 percent Monday, a sign investors expect detente to prosper despite Trump´s rhetoric.

Given Castro was no longer in office and the mixed feelings abroad over his legacy, Tuesday’s ceremony in Havana attracted only a scattering of world leaders, mainly from Latin America, the Caribbean and Africa.

The Kremlin said Russian President Vladimir Putin would not attend as he was preparing for a major speech, while Canadian Prime Minister Justin Trudeau was also skipping after warm comments he made about Castro triggered a backlash.

Brazilian President Michel Temer was also not attending. But Robert Mugabe, the 92-year-old president of Zimbabwe, was expected to arrive, as was Venezuelan President Nicolas Maduro.

North Korea called for three days of mourning and said it would keep flags at half mast to honor Castro, its state news agency said.

Cuba’s rich variety of music, a soundtrack on the streets of Havana, has been muted since Friday night and the government has also temporarily banned alcohol sales and suspended the professional baseball season.