SALT LAKE CITY -- In emotional debates in the House, a pair of bills that attempt to balance gay rights and religious liberties passed.

Senate Bill 296 would add sexual orientation and gender identity to the state's nondiscrimination law, while at the same time taking steps to ensure that people's religious liberties are protected.

READ WHAT SB296 DOES HERE

The gallery was packed as Rep. Brad Dee, R-Ogden, presented the bill. Behind him were his co-sponsors, Sen. Steve Urquhart, R-St. George, and Senate Majority Whip Stuart Adams, R-Layton.

"There was a lot of people and a lot of faith that went into this particular bill," Dee said, crying.

An LGBT nondiscrimination bill, which has been attempted for years in the Utah State Legislature, got massive support after it received the blessing of The Church of Jesus Christ of Latter-day Saints. SB296 was the product of heavy negotiations between its sponsors, gay rights groups and the LDS Church.

"We are all people and I believe we all deserve protection equally," Dee said.

But not every member of the House was supportive of the bill. Rep. Jeremy Peterson, R-Ogden, who said he was a landlord and a member of his LDS Church's bishopric, questioned if there was a need, noting he rented to gay people and had never heard any complaints.

Rep. Ken Ivory, R-West Jordan, said the process was being rushed.

"This is a very deep constitutional dive into a very shallow pool of time and process," he said.

Rep. Sandra Hollins, D-Salt Lake City, took her fellow lawmakers to task declaring it "embarrassing" that they even had to deal with this in 2015. Rep. Keven Stratton, R-Orem, believed "Utah can be a light on the hill to lead" by passing model legislation.

"Homosexuality is not a civil right but equal access to housing and employment is," Rep. Merrill Nelson, R-Grantsville, said.

In a 65-10 vote, SB296 passed. The gallery, filled with many members of Utah's LGBT community, erupted in applause. The vote was so emotional, the House reading clerk could not find the words to start reading the next bill. She wiped her tears and handed the next bill to an assistant to read.

See the vote breakdown here:

Outside the House chamber, people cried and hugged each other in celebration.

"It means for me personally I can go anywhere in the state for a job," said Sophia Hawes-Tingey, wiping tears from her eyes. "I can work, I don’t have to live on eggshells and worry what people think about my gender identity or my sexual orientation wherever I work."

Michelle Turpin, who was arrested last year protesting in support of LGBT nondiscrimination, hugged Equality Utah director Troy Williams.

"It means that we’ve finally been heard and validated," she told FOX 13. "First time in seven years and finally, they’ve listened to us. It’s relief."

Equality Utah director Troy Williams called the passage of SB296 "monumental."

“This vote proves that protections for gay and transgender people in housing and the workplace can gracefully coexist with the rights of people of faith," he said. "One does not exist at the expense of the other."

Governor Gary Herbert said he would sign SB296 into law in a special ceremony on Thursday night. In a statement Thursday, the LDS Church said:

“We are pleased that the Utah Legislature has passed Senate Bill 296. It reflects the very best of collaboration and statesmanship from groups and individuals who may not always agree on all things, but who have passed landmark legislation that balances religious freedom and antidiscrimination. While other states may find a different solution, we hope this fair, balanced approach shows that fairness for all is possible.”

As the crowd celebrated outside, the House carried on and considered Senate Bill 297. Rep. LaVar Christensen, R-Draper, said the bill would allow employees in clerk's offices to opt out of performing same-sex marriages if they have religious objections. However, someone in the office would have to be able to marry a same-sex couple.

"I'm concerned about this bill," said House Minority Leader Brian King, D-Salt Lake City.

King told his House colleagues that public officials should check their religious beliefs at the door, calling SB297 "a solution in search of a problem." Rep. Norm Thurston, R-West Valley City, noted that many House members were uncomfortable with SB296, and urged support for SB297.

Rep. Christensen emphasized the bill protected people's religious liberties. It passed by a huge 66-9 margin, with mostly Democrats voting against it.

See the vote breakdown here:

The bill had support from the LDS Church, who issued a statement to FOX 13 on Wednesday night:

The Church has been consistent in its support of marriage between a man and a woman while teaching that all people should be treated with respect. There have been various attempts discussed by lawmakers to deal with the changing definition of marriage in our state. We are supportive of SB297 because it is a more balanced and fair approach to marriage and religious freedom protections.

On Thursday morning, the Senate gave final approval to SB297, which now goes to Governor Herbert.

Immediately after passing SB297, the House considered House Bill 322, a religious liberties bill sponsored by Rep. Christensen.

"This is an affirmation of our religious liberty rights," Christensen said of his bill.

HB322 was introduced early in the session, after the LDS Church issued support for SB296. Christensen has insisted his bill complements the others, but it has been blasted as a "license to discriminate" by gay rights activists.

King blasted the bill, calling it "wrong" and questioned if it was constitutional.

"We should not go down this road of fusing church and state!" he complained to the House.

But Christensen said the bill was necessary to protect people of faith.

"This is needed," he said. "It's appropriate."

The bill passed the House 54-21.

See the vote breakdown here:

HB322 now goes on to the Senate for consideration on the last day of the Utah State Legislature.

"I think it will have a difficult time in the Senate," Sen. Jim Dabakis, D-Salt Lake City told FOX 13 late Wednesday.