Barbara Branden, who wrote a definitive biography of philosopher and novelist Ayn Rand after a close association that ended in a disastrous tangle of relationships, died Wednesday in a rehabilitation center near her home in West Hollywood. She was 84.

Her death from a lung infection was confirmed by longtime friend Wallis Grover.

Branden was the author of "The Passion of Ayn Rand," a 1986 biography that earned wide praise for its insights into the writer best known for novels "The Fountainhead" and "Atlas Shrugged."

But Branden's relationship with Rand was, like Rand herself, riddled with paradoxes and contradictions.

"My years with Ayn Rand were often terribly painful and difficult," Branden once said in an interview for Contemporary Authors. "Yet I would not have missed those years."

Branden was a college student in 1950 when she met Rand, a Russian émigré who survived the Bolshevik Revolution and built a cult-like following in the United States as a champion of laissez-faire capitalism and rational self-interest, the pillars of the philosophy she called objectivism. She was embraced by conservatives and libertarians, with admirers who included Nobel Prize-winning economist Milton Friedman and former Federal Reserve Board Chairman Alan Greenspan.

"I thought she was a genius; I thought so the first night I met her," Branden recalled in the Washington Post in 1999. "One of the things that held me all those years when I should have left was that incredible mind."

Born Barbara Weidman in Winnipeg, Canada, on May 14, 1929, she moved to Los Angeles to study philosophy at UCLA, graduating in 1951. She later earned a master's degree in philosophy from New York University, where she studied under Sidney Hook.

While at UCLA, she became engaged to Nathaniel Branden, who shared her passion for Rand's ideas. They arranged to meet Rand at her home in the San Fernando Valley and were swept into her inner circle.

In a letter to Branden's mother in 1950, Rand wrote that she was impressed by her intellect. "I feel a great sympathy for Barbara because she reminds me of myself at her age," Rand wrote, "and I know what sort of subtle injustice an intellectual girl has to suffer while she grows up. If I can help her against being hurt, I certainly will."

Rand encouraged her relationship with Nathaniel, and the two were married in 1953. But complications soon arose.

In 1954, Rand, who was also married, began an affair with Nathaniel, who was 25 years her junior. It commenced after a discussion led by Rand that can best be described as bizarre, involving Marxism, self-interest, the irrationality of the human sex drive and her desire that both her husband and Barbara Branden consent to the romance.

Rand's husband, Frank O'Connor, agreed to vacate their apartment twice a week to allow his wife to conduct her tryst in private. She swore the men and Branden to secrecy, never minding that one of the central tenets of objectivism was honesty.

"At the time, it made sense to all four of us," Branden said in the New York Times in 1998. "Ayn had powerful arguments. She believed romantic love was 'a response to your highest values.' Nathaniel represented that to her and she to him; therefore it was inevitable they would be in love."

In 1958, the Brandens formed the Nathaniel Branden Institute to promote Rand's ideas through lectures and books.

"What she and Nathaniel did together with the institute … systematized those ideas and put them into a coherent whole, outside the context of Ayn's fiction, as an actual philosophy," said James Peron, who runs the Moorfield Storey Institute, a libertarian think tank.

Despite their substantial contribution to shaping Rand's legacy, the Brandens were expelled from the philosopher's inner sanctum in 1968, when Nathaniel Branden ended the affair. The Brandens divorced in 1969; they had no children and she never remarried. He later wrote a tell-all memoir, offering many details of his sex life with Rand, including how they made love with their coats on.

Branden also candidly discussed the knotty relationships in "The Passion of Ayn Rand," which received largely positive reviews for its balanced treatment of the controversial writer's life.

Carolyn See, in a review for the Los Angeles Times, described it as "the kind of work that holds you with a horrid fascination, makes you snicker out loud, and wake up the person sleeping next to you in the dead of night. ... Those who have been taught that stability is necessary for a productive artistic or financial life may have another think coming after reading this volume."

The book inspired a TV movie, "The Passion of Ayn Rand," starring Helen Mirren as Rand and Julie Delpy as Branden. Branden appeared briefly, playing her own mother.

Despite the split with Rand, Branden never lost her ardor for the philosopher's ideas and continued to extol them at conferences and other events.

"It's curious because you'd think someone with such a deep … troubled, emotional connection to a person might skew in a certain direction," said Brian Doherty, a senior editor at Reason magazine. When he was writing an intellectual history of libertarianism, he visited Branden, who was then living in New Mexico. He recalled her generosity in allowing him to interview her for eight hours and spend the night on her couch.

"I think she did that not just out of kindness," he said, "but a continued dedication to ensuring that the story of objectivism remains out there. That was always her goal … to normalize Rand as part of American philosophical history. She waved the flag for Rand until the end."