Former Cuban leader Fidel Castro has died at age 90, according to Cuban state media, confirms NPR.

Castro, who took power in the Cuban revolution in 1959, led his country for nearly 50 years.

After undergoing intestinal surgery, Castro had ceded power in July 2006, to his younger brother Raul, who announced his death late Friday on Cuban state television.

Under Fidel Castro's direction, Cuba became the one and only communist state in the Western Hemisphere.

One of the most prominent international figures in the last half of the 20th century, Castro inspired both passionate love and hate. Many who later lost faith in him can remember how they once admired the man who needed just a dozen men to launch the Cuban revolution.

"He was not a corrupt politician as in the past we used to have," says Domingo Amuchastegui, who was a diplomat in Castro's government until he fled Cuba in 1994. "He was a very promising, courageous, dedicated, intelligent kind of people — an excellent fighter, a man willing to risk his life for his ideas."

A Young Rebel

Fidel Castro got involved in revolutionary politics while still a teenager. In his 20s, as a young lawyer, he began organizing a movement to overthrow Fulgencio Batista, Cuba's military dictator.

After leading a foolhardy effort to take over a military barracks, Castro captured the imagination of the Cuban people, and by the time Batista fled the country on Jan. 1, 1959, the charismatic 32-year-old rebel had much of the country behind him, rich and poor alike.

"Most of the upper classes in Cuba supported the revolution and right after 1959 helped it out — paid their taxes, which they never paid," and made financial contributions, says Alfredo Duran, who was a college student from a prosperous Havana family. Society women even volunteered as nurses, he says.

Even the U.S. government, long Batista's key ally, had turned against him at the end and cautiously welcomed Castro as Cuba's new leader.

Castro Goes To Washington

On a visit to Washington in April 1959, Castro presented himself as a political moderate. A highlight of his trip was a guest appearance on NBC's Meet the Press, where he reassured those who feared he might be a communist and made a promise he would never fulfill.

"Democracy is my idea," he said. "I [do] not agree with communists... What we want is to get as soon as possible the condition for free election," he said, adding that the process would not take more than four years.

If Castro wanted to make a good impression on his American hosts, however, he also wanted to show he had come to the United States on his own terms.

Castro did not get invited to the White House on that 1959 trip — and that was just fine with him, according to the late Ernesto Betancourt, who accompanied Castro to Washington as his first foreign trade director.

"A lot has been said that Fidel was hurt because [President] Eisenhower went to play golf and didn't have lunch with him ... that's nonsense," Betancourt recalled in a 2003 interview with NPR. "Fidel, even when he was told by the ambassador that the meeting was arranged with Vice President Nixon at the time, Fidel got very annoyed because he didn't want any official meetings."

In fact, that 1959 trip would be the only one Castro ever made to Washington. Like many Cuban nationalists, Castro was deeply distrustful of the United States, which had dominated Cuba ever since the country gained its independence from Spain.

In 1958, Castro had told a confidante that his rebellion against Batista would be followed by "a longer and bigger war" against the Americans. That, Castro said, will be my "true destiny."

Confronting The U.S.

In his 2003 interview with NPR, Betancourt said that Castro's view of the United States was shaped by what he saw as a child. Castro grew up on his father's farm in eastern Cuba, where most of the nearby land belonged to a U.S.-owned corporation, the United Fruit Company.

Castro saw a "second-class citizenship" within this colonial enclave, Betancourt said. For example, a club for American mill workers largely excluded Cubans who wanted to swim or play tennis.

Once Castro was established in power, he expropriated U.S.-owned property in Cuba and took an increasingly hostile attitude toward the United States. Within four months of his trip to Washington, the Eisenhower administration had drawn up a plan to overthrow Castro.

He aligned himself instead with Cuba's poor — who saw their rents reduced and utility bills cut, and who benefited from the construction of new schools and hospitals around the country.

"A lot of people who had been left out for many years took advantage of that to say, 'Now is our time under the sun,' " says Duran, the former college student in Havana who is now a Cuban exile.

But Duran and other middle-class Cubans, professionals and businessmen soon became alarmed by the country's new radical direction.

"Unfortunately, it turned out bad," Duran says. "It turned out that this guy had such an ego ... and wanted so much power and wanted to be an international figure that he embraced the communists and the Soviet Union."

Duran was among several hundred thousand Cubans who fled to Miami. He later fought in the U.S.-supported Bay of Pigs rebellion, the first of many efforts by Cuban exiles and their U.S. government backers to remove Castro from power.

A Ruthless Autocrat

Historians debate to this day whether Castro was a communist from the time he took power, or only became one after he was spurned by the United States.

What is not disputed is that from his earliest days in politics, Castro was an autocrat who moved ruthlessly against anyone who dared oppose him. More than 400 of his political enemies were executed by firing squad in his first 90 days in power.

As Cuba's leader over the next 40-plus years, Castro answered to no one and allowed no challenge to his authority. Amuchastegui, who was with him often while serving in the Cuban foreign ministry, says Castro sought advice when making a decision but in the end did things his own way.

"Once he became convinced of any of these projects, despite whatever evidence, despite whatever arguments against that project, he stood by his convictions and he would go on and on regardless of everything and everyone," Amuchastegui says.

Some of Castro's biographers think his stubbornness came from the years he spent in strict Catholic boarding schools. He was a born rebel; unlike his brother Raul, Fidel Castro was never close to his family — not to his parents, not to his wives, not to his children.

He did not hesitate to order the arrest of former friends and associates if he suspected they were conspiring against him. He set up an immense security apparatus to keep him in power.

And yet, Castro was not interested in personal enrichment; he deployed his enormous authority on behalf of health, education and welfare programs that brought Cuba attention around the world.

Near the peak of his international popularity, in October 1979, Castro addressed the U.N. General Assembly on behalf of the 94 countries in the "nonaligned" movement. Castro told the U.N. delegates that if they were to talk about human rights, they should talk also about the rights of humanity.

"Why do some people have to go barefoot, so that others can drive luxury cars? Why are some people able to live only 35 years, in order that others can live 70 years? Why do some people have to be miserably poor, in order that others can be extravagantly rich? I speak for all the children in the world who don't even have a piece of bread!"

'A Complex Figure'

But interest in Castro's Cuban model declined once the flaws of his centrally planned socialist system became obvious. The collapse of the Soviet bloc ended the massive subsidies that had kept the Cuban economy afloat. The once-vaunted education and health care system fell into disrepair.

Castro's stubbornness, meanwhile, made political and economic change difficult in Cuba. As his country crumbled around him, Castro's stature diminished, abroad and at home.

"Had Fidel died in 1985, he would have seemed like a much more impressive figure with a much more substantial legacy," says Jorge Dominguez of Harvard University, who followed Castro for many years.

As it is, Dominguez gives Castro at best mixed marks. The leader who wanted to uplift the poor and educate the illiterate was also a megalomaniac, determined to hold on to power at all costs.

"He also ordered the imprisonment and abuse of hundreds of thousands of people during the course of his career," Dominguez says. "That's what makes him such a complex figure. When he did things for good, he did a great deal of good. And when he did things for bad, he did a great deal of bad."

When Castro's brother Raul finally took over, he maintained the system that his older brother had built, but he did institute changes. Raul Castro opened up the economy a bit, allowing Cubans to own small private businesses. And in his most dramatic move, Raul Castro and President Obama announced in December 2014 that the two countries would move to normalize relations, including opening embassies in both countries.

Copyright 2016 NPR. To see more, visit http://www.npr.org/.