SALT LAKE CITY — Hundreds of same-sex couples waited for hours at the Salt Lake County Clerk's Office in a race against the clock Monday as Utah officials sought to close an unexpected window allowing them to wed in the state.

But a stay of the ruling that legalized same-sex marriage in Utah never came, opening the way for many gay couples to obtain marriage licenses. In all, about 700 licenses across the state have been issued since Friday's ruling.

Approximately 1,500 people gathered Monday night at a rally at the Salt Lake City-County Building to celebrate the surprise decision from U.S. District Judge Robert J. Shelby that led to same-sex weddings in Utah.

The crowed chatted happily with each other. Many hugged and most seemed oblivious to the cold. Several joined in with a band, singing to a Bob Marley tune: “One love, one heart. Let’s get together and feel all right.”

Several people held signs that said “Love equals love” while others waved rainbow flags.

Andrea Smith came to the rally with her husband, his parents, and her brother-in-law and his partner, Matt Alder. She said she hopes Alder will also soon be her brother-in-law.

“We want to be a part of history,” she said. “This is the civil rights movement that my parents talked about. This is happening today and we’re proud to be a part of it.”

Alder said as an former member of the military, he is thrilled to have the same rights that he fought for.

“The thought that I could finally actually spend the rest of my life with my partner if I wanted to, that I had the right to, it’s the most important thing for me,” he said, getting emotional. “That I could finally have that same happiness everyone else has, that is huge.”

While many lined up Sunday night at the Salt Lake County Clerk's Office, others trickled in through the early morning waiting for the office to open at 8 a.m., just an hour before Shelby began hearing arguments to stay his ruling that overturned the state's constitutional definition of marriage.

A team of frenzied clerks hurried to issue as many marriage licenses as possible while a team of volunteer clergy and officiants filled the lobby and wandered the halls performing marriages for cheering and weeping strangers.

Salt Lake County Attorney Sim Gill hovered nearby, waiting to halt the barrage of weddings if the emergency stay was granted.

But it wasn't.

"As far as we're concerned, we are going to continue to issue those licenses appropriately," Gill said, drowned out by a cheer that swept through the building as word spread that Shelby had denied the state's motion for a stay.

The county processed everyone in the massive line Monday, issuing 353 licenses, Salt Lake County Clerk Sherrie Swensen reported. An additional 124 licenses were granted in Salt Lake County on Friday. Both days beat the office's all-time record of about 80 licenses, she said.

Same-sex couples also rushed to get marriage licenses Monday in other county offices across the state, and 21 counties were offering them.

Davis County issued 121 marriage licenses and Weber County issued 95.

After several hours of deliberation, representatives from Sanpete and Sevier counties announced Monday afternoon they would have licenses available on Tuesday. However, clerks in Box Elder, Juab, Piute and San Juan counties were not issuing licenses, saying they were awaiting further direction on how to do so.

To avoid the confusion that they say surrounds Shelby's ruling, Cache County officials stopped issuing marriage licenses altogether on Monday and closed the county offices.

"Given the status of the pending motion for a stay and the appeal that will be filed by the state of Utah, the Cache County Clerk's office will be closed until further notice," said a statement issued by the county.

Cheryl Haws and Shelly Eyre served the Utah County Clerk's Office with a lawsuit Monday after the clerk's office refused to grant them a marriage license. The county had also turned away couples on Friday.

"We thought about it this morning, we could have gone to Salt Lake County and got in line with everyone else, but we thought, 'Why should we have to do that? We live in Utah County,'" said Haws, who asserts the county violated their rights.

Utah County Clerk Bryan Thompson said he is awaiting clarification on a complicated issue.

"There's just enough issues and questions that we've had that we wanted to proceed prudently," Thompson said Monday. "By no means is it an attempt to defy a judge."

Lisa Williamson and Christie Jacobs, partners of three years, were anxiously approaching the door to the Salt Lake County Clerk's Office Monday when the cheering from Shelby's decision erupted. Even through their nervous, five-hour wait, the two women said they hadn't given up hope.

"There's always that 1 percent chance that (a stay) could have happened, and then we would have been here for nothing," Jacobs said.

"We're still watching the clock, it's not going to be real until we have that paper in our hand," Williamson responded.

The Salt Lake couple said they had been discussing marrying next summer, but when they heard Friday that Utah's Amendment 3 had been struck down, their mind was made up — they wanted to get married in Utah.

After being among the hundreds turned away from Weber County's offices on Saturday and anticipating pushback in their home of Utah County, Shauna Griffen and Brooke Shepherd spent the night waiting in line outside the Salt Lake County building.

Wearing matching shirts proclaiming "Love conquers hate," the two women were some of the first to receive their licenses before running to meet the Rev. Curtis Price, who was waiting for them in the lobby.

"It was a long night, we were worried," Griffen said. "I had faith in Salt Lake County, they came through."

The couple, together five years, had reservations to be married in Seattle next summer.

During the rally Monday night, organizers from Restore Humanity stopped the music as Clyde Peck and Stanley Trujillo came forward to be married on the steps of the city-county building.

“It’s been such an amazing time for us,” Peck said standing with his new husband, showing off their rings. “This is all happening so much faster than we’d ever expected it to be.”

Peck said he and his partner have been together for 17 years and to be recognized as a married couple is “the best it can be.”

Adam Larsen, 11, was there with his parents and his 13-year-old brother. The family said they came to support their neighbors and friends, some of whom camped out Sunday night to be married on Monday.

“It’s pretty amazing,” Adam said. “I was thinking Utah would be one of the last to do it, but they’re one of the first.”

Email: mromero@deseretnews.com; eeagar@deseretnews.com

Twitter: McKenzieRomero