Iowa state Senator and U.S. Senate candidate Joni Ernst (R) says she thinks the legality of same-sex marriage should be left up to the states -- but would still support a federal ban on gay marriage if one were proposed.

During Thursday's Republican debate, the candidates vying for the GOP nomination were asked for their take on same-sex marriage.

"I do believe that marriage is between one man and one woman, and I also believe that this is a state's right. And I have a record of this here in the state of Iowa," she said. "It is up to the people to make that decision, so allow the states to make that decision."

Ernst noted her work on a bill in the Iowa state Senate authorizing a vote on a constitutional amendment banning same-sex marriage in the state. Ernst was one of the bill's co-sponsors.

But despite her support for the right of the people "to make that decision," she said she would back a federal constitutional amendment barring gays and lesbians from getting married.

"If it would come up at the federal level, I would support it," she said.

Ernst will face a field of four other Republicans in the June 3 primary. The winner of next Tuesday's contest will likely go on to face Democratic frontrunner Bruce Braley in the race to replace outgoing Sen. Tom Harkin (D-Iowa).