Talk about tapping into the zeitgeist.

With most polls now showing a majority in favor of marriage equality, 12 states legally recognizing gay marriage and the U.S. Supreme Court poised to rule on the constitutionality of the Defense of Marriage Act, or DOMA, the timing would seem ideal for "I Do," the romantic drama that opened May 31 in Los Angeles and more than a dozen other cities that involves gay rights, same-sex marriage and the definition of family. Yet this heartfelt tale took a more circuitous route to the big screen than its opportune release might suggest.

David W. Ross, the writer and star of "I Do," — and onetime British boy band sensation as a member of the popular Bad Boys Inc. from 1993 to '95 — began working on the script more than eight years ago. In a recent joint interview with the film's director, Glenn Gaylord, Ross explained how he was "catapulted" into writing the movie after the collapse of his relationship with a fellow Brit.

PHOTOS: Summer Sneaks 2013

Ross' then boyfriend was denied immigration status and, without the option of a nationally recognized marriage to keep him in the United States (DOMA denies federal benefits to legally married same-sex couples), had to move back to England. "'I Do' came out of heartbreak, really," Ross said with a rueful smile.

Despite the gravity of the breakup, Ross first conceived the screenplay as a kind of comedic, gay-themed twist on 1990's "Green Card," the romantic comedy in which an American woman marries a Frenchman so he could remain in the U.S. Ross continued in that direction until a watershed moment in 2009 while he was working as the official photographer for a rally in Fresno against California's Proposition 8 banning gay marriage.

Ross said he was struck while watching so many dedicated gay and lesbian parents and their children marching in support of gay marriage. "I realized 'I Do' shouldn't be some funny, quirky movie but one that honestly portrayed American life when you're in a same-sex couple and you don't have the same rights [as a straight couple]," said Ross, his dashing good looks offset by thick-framed eyeglasses and a self-deprecating warmth.

The experience caused Ross, who previously acted in the 2006 Sundance Film Festival hit "Quinceanera," to switch gears and turn his script into a more serious look at the weighty issues he'd been humorously exploring.

PHOTOS: Gay celebrities: Who's out?

This led to another realization for the tyro screenwriter. "I began to notice that a lot of binational couples live in the shadows," said Ross. "The people from another country can't live their life fully — don't want to live their life fully — because they're worried about being deported at any moment." (Last month, a Senate judiciary panel withdrew a proposed amendment extending immigration rights to same-sex couples as part of an immigration reform bill.)

In the movie, Jack Edwards (Ross), a fashion photographer's gay assistant with an expiring work visa, marries his lesbian best friend in a last-ditch effort to stay in the U.S. As complicated as that sham proves, matters snowball when Jack falls in love with a gentle architect born in New York but raised in Spain (a country where, not incidental to the plot, gay marriage is legal).

Two years — and many script drafts and several successful crowd-funding campaigns later — "I Do" was on its way to being shot. Additional financing was raised by long-attached producer Stephen Israel ("Swimming With Sharks," "Boy Culture"), who then brought on Glenn Gaylord, who'd previously worked for Israel as writer-director of the 2007 comedy "Lez Be Friends."

Gaylord said he was "blown away" when he first read Ross' screenplay. "It was the kind of character-driven drama that I was really aching to make," enthused Gaylord, who also directed 2009's "Eating Out: All You Can Eat" and wrote the 2011 indie musical feature "Leave It on the Floor."

PHOTOS: Hollywood backlot moments

Like Ross, Gaylord had his own personal connection to the story of "I Do." The director's stepsister, Mimi, although legally married in California in 2008 to an Israeli-born woman, could not obtain U.S. citizenship for her spouse (whose work visa had expired) because of DOMA. Mimi ended up moving to Israel to be with her wife and their young son, thus separating her from much of the large, tightly knit Gaylord family. (Another of Gaylord's sisters lives with her same-sex partner in Australia where, as a binational couple, they also enjoy more rights than they currently would in the U.S.)

"I knew I had to make this movie," Gaylord said. But first, he had one request for Ross: to infuse a bit more of the comedy back into the script. "Not in a wacky way," recalled Gaylord, "but in a real, character-driven way."

After a brief final rewrite, production on the micro-budgeted film was underway in Los Angeles, which quite effectively doubled for Manhattan and Brooklyn. The movie, which co-stars Jamie-Lynn Sigler, Alicia Witt, Maurice Compte and Grant Bowler, shot locally for 16 days at such locations as Hollywood's trendy Redbury Hotel. The crew then filmed two days of exteriors in New York, with a final day in Temecula, , which subbed for, let's just say, a pivotal, far-flung location.

"I Do" went on to spend the better part of the past year on the festival circuit beginning with a premiere last summer at L.A.'s Outfest. Award-winning stops in Miami, Philadelphia, Atlanta, Seattle, Palm Springs and elsewhere followed. A review in the Hollywood Reporter singled out the film's "sympathetic characters and moving elements."

(Coincidentally, just two weeks after "I Do's" theatrical opening, "Married and Counting," another film involving gay marriage, will hit the big screen. The documentary, narrated by openly gay actor George Takei of "Star Trek" fame, follows two men celebrating their 25th anniversary together by traveling the U.S. to marry in every state that will let them.)

Ross and Gaylord have high hopes that audiences will not only be moved and entertained by "I Do" but stirred to action.

"I want people to walk away from the film realizing that 'love is love,'" Ross said. "And if they're as completely gobsmacked by it as people who've spoken out in our [post-festival screening] Q&As, that they'll want to do something about the fact that we have DOMA."

Gaylord added, "If people watch 'I Do' and really understand how the issues it portrays affects entire families — and not just the gay person in the family — that is a contribution that I'm really proud of with this film."

calendar@latimes.com