On August 14, Ilhan Omar, a five-foot-tall Somali immigrant who moved to the United States from a refugee camp when she was 12, became the second Muslim woman to win a major party primary in a federal election. Seven days earlier, Rashida Tlaib from Michigan became the first. Ms. Omar, 35, defeated a field of six candidates for the Democratic nomination in Minnesota’s heavily blue fifth congressional district, a seat formerly held by Rep. Keith Ellison.

One week after her historic victory, Ms. Omar was at the Chilmark Community Center for a screening of filmmaker Norah Shapiro’s documentary, Time For Ilhan, as part of the Martha’s Vineyard Film Festival. The documentary follows Ms. Omar’s first political campaign in 2016, when she defeated a 42-year incumbent to take her seat in Minnesota’s House of Representatives. In two years, Ms. Omar went from a community organizer, to the first Muslim woman to hold elected office, to the first Somali woman to win a major party nomination for Congress. Barring disaster, she’ll become the first Somali woman in Washington.

Did she have any idea her political rise would be this meteoric?

“No, no, no,” she said. “Well, now it’s a running joke, because everybody used to say we’ll do things differently in six to eight years when I run for Congress. Now they say we’ll do things differently in six to eight years when I run for Senate.”

Film director Norah Shapiro. — Mark Alan Lovewell

Those plans are still in the works. “But this was never a thought I was thinking about, and certainly not a year and a half after I was elected to the Minnesota House.”

Ms. Omar laughed as she poured a fifth packet of sugar into her coffee. “I’m liberal with my cream, too.”

Throughout the film, Ms. Omar galvanizes the large Somali community in Minnesota to vote for a woman rather than her male Somali counterpart, something that goes against deep-seated cultural traditions, while also bringing students and young people to ballot booths in heretofore unseen numbers. She won the race handily.

“I have long been fascinated by the Somali community in my own backyard,” director Norah Shapiro said. “Within moments of meeting Ilhan, I knew that following the story of her going through this race, and her going up against what she was going up against was not only a fascinating story, but also an important lens for looking at a lot of bigger issues. Ilhan’s bravery in going along with this ride was extraordinary.”

Already under intense public scrutiny as a female and Muslim political candidate, Ms. Omar let Ms. Shapiro film every critical moment of her campaign, along with her home and family.

“Naturally, every worry we had as a campaign disappeared as filming went on,” Ms. Omar said. She also emphasized the importance of representation, especially since she’s now a political figure on a national stage.

“I remember watching Black Hawk Down and being furious,” she said. “Those people don’t even look Somali. It does a disservice to society when you do a whole film about a historical moment that happened in a country, and you don’t get anything that’s even aesthetically the same where it happened.” As important as Ms. Omar knew her campaign was, she still had to balance the burden of representing her constituents with the equally important job of being a mother to three children. When Ms. Omar launched her campaign for the United States House this year, her daughter found out about it on Twitter.

“We didn’t have much time to consult with them,” she said, “but they’ve been so supportive. They’re in, and fully invested, and fully excited. And I think they understand that at some level this is bigger than all of us. Whatever struggle it might seem, it’s minimal to the impact.”

The reality of Ms. Omar’s struggle is that she is now poised to become a female, immigrant Muslim in a largely white and largely male Congress. Of course, she sees herself as more than that.

“Those are my identities,” she said, “but who I am, and my ambitions, and what I am capable of, are all very different. I do often feel the weight of representation for those identities...and at the beginning of the campaign we talked a lot about being ‘the first,’ and not messing it up, because you want to do it effortlessly to inspire more people to think, oh, I can do this too.”

After the election of President Trump, which occurred on the same day Ms. Omar won her Minnesota House seat, more women than ever have decided to run for elected office.

“Women are fearless creatures,” Ms. Omar said. “We give birth. We are about hope. I think for us, our innate ability to fight against this divisive, destructive administration is like the mama bear, to really be in service of those who need protecting, and uplifting.”

Come November, it’s possible Democrats will take control of the House.

“I don’t see a scenario where this ends well for the President,” Ms. Omar said. “So I think there a lot of ways where one can start the impeachment process, and I’d be a part of that.”

Ms. Omar also hopes to continue to carry on Mr. Ellison’s progressive legacy in Congress. She was particularly excited about a bill that allows gas payments, phone payments and rental history to count as credit, furthering her platform that defines housing as a human right.

When Ms. Shapiro decided to make a film about Ms. Omar two years ago, she didn’t know Mr. Trump would get elected, nor did she know Ms. Omar would win. And she had no idea Ms. Omar would be on her way to Washington one year later.

“The point wasn’t whether or not Ilhan won,” Ms. Shapiro said. “It was about the story. I knew she was a winner.”