Updated

Mitt Romney delivered a commencement speech Saturday at Liberty University in which he focused largely on a message of faith, family, hard work and service, but he also addressed the emerging same-sex marriage issue by saying "marriage is a relationship between one man and one woman."

The remark drew a loud applause for the likely GOP presidential candidate who faced a big test in trying to win over evangelical voters.

Students at the  Lynchburg, Va., school -- the largest Christian college in the world -- follow a strict code of conduct that considers sex out of wedlock and homosexuality to be sins.

Romney, a Mormon, also delivered the speech in the heart of conservative Virginia, following President Obama’s recent announcement that he personally supports gay marriage.

In the 20-minute keynote speech at the school founded by Baptist and TV evangelist Jerry Falwell, Romney appealed to the graduating class -- along with their families and others -- largely by sticking to the argument that he is the best candidate to improve the economy

“For you and so many young Americans, our current troubles can be discouraging,” said Romney, the former Massachusetts governor. “Millions wait on the day when there are jobs for everyone willing to work, and opportunities to match your hopes and your goals.  But don't lose heart, because that day is coming.”

Though Romney won the 2012 Virginia primary, social conservative GOP candidate Rick Santorum, who pulled off several primary victories in the South before exiting the race, was not on the ballot.

“The best cultural assets are values as basic as personal responsibility, the dignity of hard work, and, above all, the commitments of family,” Romney also said. “Take those away, or take them for granted, and so many things can go wrong in a life.  Keep them strong, and so many things will go right.”

Though Romney urged the graduates to work hard, he also reminded them to strike a balance.

“I have never once regretted missing any experience or opportunity in business in order to be with my wife and five sons,” he said. “Regrets usually come the other way around, from missing moments with your children that don't come again.”

Liberty University has become a destination for Republican politicians looking to speak to the religious right.

Romney's campaign team -- planning the speech long before gay marriage became a central issue -- viewed it as an opportunity to address the kind of socially conservative audience that had been wary of him during the prolonged Republican primary fight.

For Romney, the challenge was twofold. His past policy positions, including support for abortion rights, don't sit well. But his personal faith is also an issue because many evangelicals don't consider Mormons to be fellow Christians. Evangelicals are a critical segment of the Republican base.

Romney discussed his own family and offered a defense of Christianity, saying that "there is no greater force for good in the nation than Christian conscience in action."

Still, he was inclusive: "Men and women of every faith, and good people with none at all, sincerely strive to do right and lead a purpose-driven life," Romney told the graduates -- gathered in the school's football stadium.

When he locks in the Republican presidential nomination, Romney will make history as the first Mormon nominee from a major party. His faith is central to him and to his family -- he spent two years in France as a missionary.

Upon returning home, Romney attended Brigham Young University, a Mormon school, and married his wife, Ann, who had converted to Mormonism.

As they built a life in Boston, Romney took on a significant leadership role in the church, serving as a lay pastor, fighting to build a temple in town and counseling families in need. But he's mostly avoided talking about it on the campaign trail, largely avoiding religious forums and events throughout the primary season.

And at arguably the most religious venue he's addressed during the campaign -- since announcing his bid, Romney hasn't made a public appearance in a church of any kind -- he continued to keep his own faith in the background.

"This isn't a speech about Mormonism," senior adviser Eric Fehrnstrom told reporters Friday on a conference call. Fehrnstrom pointed to the speech Romney gave in Texas in 2007 during an unsuccessful bid for the Republican presidential nomination in which he outlined his faith and defended religious freedom -- the last time the former Massachusetts governor has addressed his faith in any detail.

Still, it was clear the campaign was keenly aware of the overtones.

Romney was introduced by Mark DeMoss, an evangelical who has repeatedly defended Romney's faith on the campaign trail. "I suspect I won't agree with Mitt Romney on everything, but I will tell you this: I trust him. I trust him to do the right thing," said DeMoss.

Despite the concern, surveys have shown for months now that whatever reservations Republican evangelicals have about Romney's faith, they are likely to back him in the general election against Obama. The president's endorsement of same-sex marriage was likely to further boost Romney's standing among social conservatives.

As governor of Massachusetts, Romney championed a state constitutional amendment to bar gay marriage. He says he supports a federal constitutional amendment to bar gay marriage.

Still, Romney has a history of supporting certain gay rights. He is in favor of allowing states to give same-sex couples certain domestic partnership benefits, including adoption.

Romney's views on gay marriage and other social issues are shaped by the Church of Jesus Christ of Latter-day Saints. Mormon doctrine defines marriage as between a man and a woman and considers sexual activity outside of marriage a sin.

The Associated Press contributed to the report.