Texas Senator Ted Cruz on Wednesday called for prayer in support of gay marriage bans.

In his first Iowa visit as a presidential candidate, Cruz attacked a possible Supreme Court ruling striking down restrictive state marriage bans.

Such a ruling would be “fundamentally illegitimate,” Cruz said.

“Every one of us is concerned,” he said during an appearance at Morningside College in Sioux City. “The first thing, and I think the most important thing, every one of us can do is pray. Lift up in prayer.”

The nation's highest court will hear arguments in a case challenging bans in four states later this month, with a ruling expected in June.

Cruz repeated his support for a “religious freedom” bill in Indiana which critics say will open the door to discrimination against gay men and lesbians, saying the state was “doing the right thing.”

“Religious liberty is not some fringe view. It is the basis of this country,” he said.

Backlash over the bill led Republican Indiana Governor Mike Pence to ask lawmakers to “fix” the bill.