On trial in 1953 for leading a rebel attack on the Moncada military garrison in Santiago de Cuba, Fidel Castro, then a young lawyer, concluded his own defense by declaring, "Condemn me. It does not matter. History will absolve me." Now that the 90-year-old patriarch of Cuba has died, the time for history's judgment has arrived.

It's tempting to echo Zhou Enlai, who, when asked in 1972 what impact the French Revolution had on Western civilization, famously replied, "It is too early to say." Certainly, in Fidel's case — and everyone called him Fidel, even his enemies — the broad outlines of his legacy are clear enough. By his own account, he made a revolution in pursuit of two goals: to gain real independence for Cuba, freeing it from the political and economic tutelage of the U.S., and to introduce a measure of social justice to Cuba's deeply corrupt and unequal social order.

Somewhere in his intellectual development — his own accounts of when varied over the years — he decided that the only road leading to these goals was socialism. He kept that insight to himself as he led a nationalist, anti-authoritarian revolution to triumph over the Batista regime in 1959. Perhaps he was mindful of his hero, Cuba's founding father José Martí, who once wrote, "To achieve certain objectives, they must be kept under cover; to proclaim them for what they are would raise such difficulties that the objectives could not be attained." When the revolution's early reforms brought Cuba into conflict with the U.S., as Castro knew they would, he decided that the revolution's survival depended on forging an alliance with the Soviet Union.

In the revolution's early decades, Castro appeared to achieve his two goals. He purged Cuba of U.S. influence by nationalizing over $1 billion in U.S. investments and thumbing his nose at Washington's often ham-fisted attempts to rein him in. Assassination, invasion and covert war all proved unequal to the task of dislodging him, to the chagrin of Washington policymakers, who could neither understand nor tolerate such defiance in their own backyard. Buoyed by the public's nationalist cheers, Fidel "hit the Yanquis hard," and they could never devise an effective way to hit him back. Even today, the residue of Washington's frustration with him continues to fuel the animus of policymakers who oppose President Obama's opening to the island.

Beginning with radically redistributive economic reforms and culminating in the nationalization of the entire economy, right down to the mom and pop stores on the corner, Castro transformed Cuba into the most egalitarian society in Latin America. Health care, education and social security were declared human rights and provided free to everyone. Income disparities shrank as wage differentials narrowed and basic consumer goods were provided to all through rationing at prices heavily subsidized by the government.

But all this came at a cost. With link between workers' compensation and productivity shattered, growth stalled. And in the service of creating a socialist economy, Castro crushed Cuba's bourgeoisie. Once the direction of the revolution became clear, the upper and middle classes began a historic migration north into exile. In just the first decade of revolutionary government, more than 250,000 Cubans fled their homeland. Over the ensuing decades, nearly a million more would follow.

Castro was a keen politician, appealing to deep currents in Cuban political culture, most especially the nationalism born of Cuba's repeated failure to win its independence, first from Spanish colonialism and then from U.S. neocolonialism. A charismatic leader par excellence, he harbored a deep distrust of institutions, believing he was a better judge of the desires and aspirations of the Cuban people than any formal structure. More than once, he tore down institutions that he himself had built when they worked in ways that endangered his vision for Cuba's future.

In so doing, he left a legacy of institutional weakness which his brother Raúl has spent the past decade trying to repair. Fidel was, as social scientists say, a "minimum winning coalition" all by himself. When he decided on a policy, the rest of the leadership dutifully fell into line. Political power, then, was directly correlated with proximity to Fidel. It was no accident that the principal path to power for an aspiring young politician led through Castro's personal staff. During the last two decades of Castro's leadership, a series of young heirs apparent rose and fell based on their personal relationships with him. Their meteoric ascendance afforded them no institutional base of support, denied them the political savvy only experience can provide, and imbued them with the hubris of Icarus. None lasted more than a few years. Raúl Castro has implicitly acknowledged the polity's institutional shortcomings by calling for a major renovation of the Communist Party, empowering local political institutions and proposing 10-year term limits for all senior officials. Strengthening institutions has been a constant theme in his public addresses.

As Cuba's "maximum leader," Fidel Castro was never one to tolerate dissent. "All criticism is opposition," he told compatriot Carlos Franqui, "All opposition is counterrevolutionary." To consolidate political control, Fidel closed off all channels for independent political expression. He dealt ruthlessly with opponents — from Comandante Huber Matos, sentenced to 20 years for treason in 1959 for his anti-communism, to 75 dissidents imprisoned for subversion in 2003 for accepting aid from the U.S. Maintaining tight political control allowed Fidel to survive dozens of assassination attempts and half a century of U.S. hostility. But the very real threat from the U.S. became the rationale for a perpetual national security state that suppressed traditional civil and political liberties, and rewarded conformity. The absence of an independent press, political parties and civil society associations left the state without the self-correcting mechanisms of a pluralist democratic society. A series of policy disasters followed.

In the late 1960s, Castro embraced Ernesto "Che" Guevara's vision of "new socialist man" — a citizen with communist conscience who would work according to his ability and consume only according to his needs. Economic policy was recast to level wage differentials and severed the link between workers' productivity and income. Predictably, many people simply stopped coming to work; productivity plummeted. In the following decade, that policy was replaced by a model of centralized socialist planning imported from the Soviet Union, based on material incentives. With it came all the distortions typical of that model, including a surge in corruption.

Although the experience of the 1960s forced Castro to acknowledge that Cubans were not ready to act like selfless citizens in a Marxist utopia, he could never reconcile himself to relying on markets. The inevitable social inequalities that markets produce, even in a state-owned economy, were simply anathema to his vision of social justice. In 1986, Fidel repudiated the Soviet planning model and launched a campaign to "rectify errors and negative tendencies," which meant once again moving away from the use of market mechanisms and toward moral incentives. And once again, the economy stagnated as a result.

This new economic experiment was abruptly cut short by the collapse of European communism in 1989-1991, which plunged Cuba into a deep depression known as the "Special Period." The loss of $3 billion annually in Soviet economic assistance reduced Cuba's import capacity by 75 percent. The resulting shortages of raw materials like fuel and fertilizer caused huge production losses in both manufacturing and agriculture, triggering a downward economic spiral. Between 1989 and 1993, gross domestic product fell 35 percent, and real wages fell by even more. Consumer goods of all types disappeared from store shelves, and people went hungry.

At first, Fidel responded with defiance, closing his speeches by declaring, "Socialism or Death!" But survival required economic concessions. At his brother Raúl's urging, a reluctant Fidel agreed to reintroduce market mechanisms to restart the economy, legalizing free farmers markets and small businesses. The government eased restrictions on direct foreign investment to attract the capital needed to modernize the tourist industry, and legalized the possession of dollars, encouraging Cuban Americans to send remittances. But Fidel was never comfortable with these reforms, regarding them as strictly temporary. "We have gone down this road basically because it was the only alternative for saving the revolution," he said at the depths of the recession. As the economy gradually recovered in the late 1990s, he scaled back the market-oriented reforms.

By the time Raúl took over from the ailing Fidel in 2006, the economy faced serious structural imbalances. Although it had been growing since the 1990s, the gains were concentrated in tourism and the export of medical services. The actual production of goods on the island still lagged below 1989 levels, and many state enterprises operated at a loss. The central problem, Raúl bluntly pointed out, was low productivity. "No country or person can spend more than they have," he reminded the Communist Party Congress in April 2011. "Two plus two is four. Never five, much less six or seven — as we have sometimes pretended."

Raúl launched a major "updating" of Cuban economic policy, relying more directly on market mechanisms to drive efficiency than at any time since 1959. As a package, these reforms resembled the early stages of China's and Vietnam's turn toward market socialism in the 1970s and 1980s. From his retirement, Fidel endorsed the new policies, admitting to a visiting journalist that Cuba's traditional model of central planning, "doesn't even work for us anymore." But the new policies clearly went well beyond anything he himself would have designed, calling into question the durability of Fidel's vision of social equality.

The price of freeing Cuba from U.S. domination was alliance with the Soviet Union, which turned Cuba into a focal point of the Cold War. The U.S. embargo forced Cuba into dependence on the Soviets, which proved to be almost as crippling as Cuba's pre-revolutionary dependence on the U.S. But while U.S. politicians routinely denounced Cuba as a puppet of Moscow, Fidel Castro took orders from no one. "He's his own man," Mikhail Gorbachev tried to explain to President George H.W. Bush at the end of the Cold War. "We cannot dictate to him."

Fidel saw the Cuban revolution as both a Third World national liberation struggle and a socialist revolution, and he had aspirations that went beyond his small island. From the earliest days, he envisioned Cuba as a model for Latin America's struggle for independence and social justice. Fidel and Che Guevara inspired a generation of Latin American youth, from student revolutionaries in the 1960s, to Central American guerrillas in the 1980s, to the "21st-century socialism" of Hugo Chávez in Venezuela, Evo Morales in Bolivia and Rafael Correa in Ecuador. Even critics harbored a certain admiration for Fidel's ability to defy the U.S. and live to tell the tale.

Beyond the Western hemisphere, Castro supported anti-colonial struggles in Africa and Asia. Cuban arms and military advisers bolstered independence movements against colonialism and white minority rule in southern Africa, and when South Africa invaded Angola in 1975 to install a puppet regime, Cuba sent 30,000 troops to drive the South Africans back across the border. Fidel won the leadership of the Nonaligned Movement in 1979 despite Cuba's close partnership with the Soviets. It was sometimes a difficult balancing act. "We are playing two roles," Fidel explained to visiting U.S. diplomats after the Soviet invasion of Afghanistan. "We are playing the role of the revolutionary and we are also playing the role of the member of the Nonaligned Movement. It's not easy."

The collapse of the Soviet Union effectively ended Cuba's ability to project military force abroad, but Cuba's global engagement remained high as soldiers were replaced by doctors and teachers. Even President Obama acknowledged the diplomatic effectiveness of Cuba's "medical internationalism." In 2006, Cuba was once again elected to lead the Nonaligned Movement, and in 2013, Raúl Castro assumed the chair of the Community of Latin American and Caribbean States (CELAC), which excludes the U.S. and Canada.

Like a good chess player, Fidel had an uncanny ability to anticipate his opponents' next moves and pre-empt them or turn them to his own advantage. "Fidel has long headlights," said one senior Cuban official, describing Castro's prescience. In 1980, when Jimmy Carter goaded Castro about the number of Cubans wanting to emigrate, Fidel threw open the port of Mariel, unleashing a flood of some 125,000 refugees. With this uncanny act of political jujitsu, Castro turned Cuba's embarrassment over how many of its citizens wanted to leave, into Washington's embarrassment over its inability to control its own coast.

When Ronald Reagan authorized propaganda broadcasts to Cuba by Radio Martí, Castro responded not by broadcasting Cuban programs to the U.S., as U.S. officials anticipated, but by suspending a recently signed immigration agreement that had been four years in the making. In 2003, the George W. Bush administration tried to goad Cuba into closing the U.S. Interests Section in Havana by directing the chief of mission to publicly embrace Cuban dissidents. Instead, Castro struck not at the diplomats, but at the dissidents they supported, arresting them by the dozens.

Fidel's political acumen was a perennial frustration for U.S. policymakers, who could never figure out how to bring him to heel. As National Security Council director for Latin America Robert Pastor wrote in 1979, U.S. policy toward Cuba was "driven out of unmitigated frustration," derived from three irreducible facts: "(1) Cuba causes us terrible problems; (2) Cuba is a little country, and we are a superpower; and (3) We have almost no leverage or influence over the Cubans."

For half a century, U.S. policymakers hoped and believed that Fidel was so central to Cuba's revolutionary regime that it would not survive his passing. In the 1960s, the CIA sought to accelerate that process through assassination. By the turn of the century, George W. Bush's administration was planning for the fall of the regime, certain it had a life expectancy no better than that of its octogenarian founder. "Your policy is to wait for me to die," Fidel lectured two U.S. diplomats in 1979. "And I don't intend to cooperate." And he didn't. Instead, he fell ill and was forced to hand the reins of authority to his brother. The transfer of power could not have been smoother; there were no protests, no riots, no rush to the exits. Not only did Fidel's revolutionary regime survive him, he lived long enough to see it.

But the goals for which Castro made the revolution face real challenges in the years ahead. The normalization of relations with the U.S., if it survives into Donald Trump's presidency, represents both a triumph and a danger: a triumph, in that Washington has finally recognized the reality and permanence of the revolution; a danger, in that it will open the flood gates to a resurgence of U.S. economic influence. During the campaign, Trump promised to roll back Obama's policy of engagement, but as recently as September, he said the opening to Cuba was "fine" if the U.S. could "get a better deal." The businessman's nose for economic opportunity might yet trump the politician's campaign promise.

Without the embargo, trade with the U.S. will quickly grow to dwarf trade with every other partner, tourists from the U.S. will dwarf the numbers from Canada and Western Europe, and investment from U.S. firms (including Cuban American firms) will dwarf investments from everywhere else. The gravitational pull of the U.S. economy could be irresistible, pulling Cuba back into the orbit of its northern neighbor and threatening to recreate the dependency the revolution aimed to end. This was the danger that Fidel himself envisioned when he warned his fellow countryman about the risks of engagement after Obama's visit to Havana last March.

Cuba's move to market socialism puts at risk the ideal of social equality that Fidel held to so tenaciously. His successors have pledged to maintain the collective welfare system of which the revolution is most proud — free health care, free education and social security. "No one will be left behind," Raúl Castro has promised. But other state subsidies for consumers are being phased out as too costly. By giving free play to market forces, Cuba's current leaders hope to boost productivity, even at the expense of increasing income disparities. Markets inevitably produce winners and losers. Already, Cubans who are well-educated, live in cities where economic development is more dynamic and have access to hard currency, are thriving in a freer economic environment. Those who are low-skilled or elderly, live in rural areas, have no relatives abroad to send remittances, and suffer from racial discrimination are at risk.

Going forward, Raúl Castro has described Cuba's task as adapting Cuban socialism to contemporary reality, while preserving the core values of national sovereignty, dignity and social justice that led Fidel Castro to take up arms half a century ago. Perhaps Fidel's greatest achievement was upholding those values long enough to pass them on, albeit a little threadbare, to a successor generation of Cubans. To them falls the task of forging an efficient, productive economy, a more open, democratic polity, and a normal relationship with the U.S. Will Fidel's legacy prove to be a foundation on which they can build, or an obstacle to progress? The answer will determine whether history will absolve him. At the moment, it's too early to tell.