On the steps of a prestigious institution, hundreds of men march confidently toward their future. In their midst is one woman—a cornflower blue dress among a sea of gray suits. Mimi Leder opens her new film with that scene, Supreme Court Justice Ruth Bader Ginsburg's first day at Harvard Law School, and it's not one the director had to close her eyes to imagine. "I've walked through those doors," says the first woman to graduate from the American Film Institute Conservatory, in 1973. "Full of fear but full of hope, always."

Unlike this summer's massively popular documentary RBG, which chronicled Ginsburg's life from birth to Supreme Court dissents, Leder's On the Basis of Sex focuses on the early years of her career, starting in 1956, when Ginsburg (played by Rogue One 's Felicity Jones) became one of nine women in her graduating class of nearly 500 men. It ends in 1972, with her landmark argument on gender discrimination—a pro bono case, argued with her tax lawyer husband, Martin (Armie Hammer). Charles E. Moritz v. Commissioner of Internal Revenue, involving a man denied a $600 caregiver tax deduction because he was a man, would fuel a decade-long fight against discriminatory laws. Much ground is covered in between, from Martin's battle with testicular cancer during law school to Ginsburg's ideological differences with her rebellious daughter, Jane (played by Cailee Spaeny), who prefers Gloria Steinem's activism to her mother's less glamorous court battles.

The 66-year-old Leder is best known for the '90s action films The Peacemaker and Deep Impact, and she was far into directing episodes of the third season of The Leftovers when producer Robert Cort contacted her about a Ginsburg film. She felt "an instant connection" with the script. "We're both Jewish, both mothers, both broke the glass ceiling in our own way," says Leder. "I've always known who Justice Ginsburg was, but I never knew her in this personal way."

The secret to that intimacy is screenwriter Daniel Stiepleman, who is Ginsburg's nephew. It was at the 2010 funeral for his Uncle Martin that the writer got the idea for the film. "A friend gave a beautiful eulogy, and mentioned the only case that Ruth and Marty ever argued together. I thought, Wow, they were my age, figuring out how to build a home, but also fighting for true equality," says Stiepleman, who is 37. "That would make an incredible movie! Then I thought, What kind of asshole am I, mining his life for material?"

Ruth Bader Ginsburg with her husband, Martin, at a gala opening night dinner following a Washington Opera performance in 2000. "Their love and relationship became a metaphor for the film and for equality,” says director Mimi Leder of the Ginsburg marriage.Karin Cooper/Liaison/Getty

Stiepleman, who went to film school but had never written a professional script, eventually mustered up the courage to ask his aunt for permission to write the film. Her response: "If that's how you think you'd like to spend your time."

Perhaps not surprisingly, Ginsburg had notes on the first draft. They were "never about her ego," says Stiepleman, but rather on doing minor characters justice ("You need to get Dr. Leadbetter right. He's the surgeon who saved your uncle's life"), giving credit to those who came before her ("People should know that I built my career on the shoulders of activists like Dorothy Kenyon and Pauli Murray") and, most crucially, getting the law right.

"I wrote a beautiful, poignant, dramatic 15-page sequence that sent Ruth on a journey to D.C. to research a law," says Stiepleman. "She was like, 'No. We have law books. This is not how we do this.' So that got taken out." Another scene, about writing a legal brief, was added; Ginsburg felt "people should understand that's important. In movies, it always comes down to oral arguments. The brief is important too!"

A major concern for all was honoring the legacy of Martin, Ginsburg's husband of 56 years and a powerhouse lawyer in his own right. Stiepleman remembers his unstinting support for his wife. Yet when the writer pitched his film, the idea of a husband who cooked all the family meals and co-shared parenting baffled some studio executives. "There was a pattern of women loving the script and their male boss saying, 'I don't believe this Martin Ginsburg character,'" says Stiepleman. "We got that note a lot: 'Change Marty! Have him threaten to divorce her!'"

"Their love and relationship became a metaphor for the film and for equality," says Leder. "I asked Justice Ginsburg, 'How did you know Marty was the one ?' She spoke of dating another guy who couldn't play charades and what an idiot he was. When she met Marty, she fell in love with his brilliance and humor. How could she not marry him?" (That "charades" comment, by the way, made it into the film.)

Armie Hammer as Marty, left, Ruth's husband of 56 years. According to Felicity Jones, right, when the real Ginsburg met Hammer, she "couldn't take her eyes off him."Jonathan Wenk/Focus Features

Leder ends the film with the real RBG, now 85, climbing the steps of the Supreme Court. (President Bill Clinton appointed Ginsburg in 1993.) "I wanted her to ascend to her future: She walked into Harvard, and now she's walking into the Supreme Court," says the director. "For me, the ending had to be about her winning, her achievements and her power to believe in herself."

Ginsburg told the director she thought the film "magnificent. She said, 'I can't imagine anyone playing me but Felicity Jones,'" says Leder. (According to Jones, Ginsburg also "couldn't take her eyes off Armie" when she and Hammer first met.) To Stiepleman, the justice said, "I just love that the film is joyous. People think of feminism in the '70s as angry, but that wasn't what it was like for me. The world was changing, we were at the forefront of that change, and we felt optimistic."

On the morning of the film's Los Angeles premiere, Stiepleman received word that his aunt had fallen and fractured her ribs. Despite her robust exercise regime (including, according to 2017's RBG Workout, daily pushups and pistol squats) it was a reminder to liberals—distraught after the confirmation of President Donald Trump's second conservative Supreme Court justice, Brett Kavanaugh—that she is vulnerable. Ginsburg has since recovered and returned to the court, but Stiepleman thinks the assumption "that RBG is a superhero who will continue to save us all" does her legacy a disservice.

Leder agrees. "Ruth Bader Ginsburg is not a superhero; she's a woman. She's a woman who changed the culture with her extreme intelligence and eloquence. This movie is about her finding her voice, and I want everyone who sees it to feel they can find their voice too."

Ruth Bader Ginsburg at a Women's History Month reception on Capitol Hill in March. In November, the 85-year-old Supreme Court justice fell and fractured three ribs, but she quickly recovered and is now back in court.Allison Shelley/Getty