SPARTANBURG, S.C. (AP) — Republican candidates will challenge President Barack Obama on foreign policy, an issue they have given scant attention in recent weeks, as they gather Saturday for their second debate in four days.

Consumed by events on the home front, two contenders are fighting to mend damaged campaigns. Texas Gov. Rick Perry blundered in a debate Wednesday, when he couldn’t remember one of the Cabinet departments he has proposed to abolish. Rival Herman Cain is battling a series of sexual harassment allegations.

Their troubles leave Mitt Romney, the former Massachusetts governor, in a stronger position. Former House Speaker Newt Gingrich has also seen his fortunes improve, reflected in a CBS News poll released Friday that had him tied with Romney for No. 2 behind Cain.

Cain, in an effort to steer the conversation away from the sexual harassment allegations, played up his faith earlier Saturday. He told a young Republicans meeting in Atlanta that God convinced him to run for president.

“I’m a man of faith — I had to do a lot of praying for this one, more praying than I’ve ever done before in my life,” Cain said. “And when I finally realized that it was God saying that this is what I needed to do, I was like Moses. ‘You’ve got the wrong man, Lord. Are you sure?'”

Gingrich was campaigning Saturday at nearby Furman University and opening his campaign’s South Carolina headquarters. The latest to benefit from party conservatives’ quest for an alternative to Romney, Gingrich is rebuilding his campaign after his top aides quit in the spring and now has nine paid staffers in South Carolina

Perry, an early leader in national polls, had been struggling to prove to supporters he could still win the nomination. Then he froze onstage Wednesday, when he drew a blank on the third federal agency he would kill as president.

“The third agency of government I would do away with — the Education, the Commerce. And let’s see. I can’t. The third one, I can’t,” Perry said. “Oops.”

He spent the time since doing damage control with a blitz of interviews and a cameo on David Letterman’s show, where he delivered a Top 10 list of excuses for his mistake. (“One was the nerves, two was the headache and three was, and three, uh, uh. Oops.”)

When they have confronted foreign policy, Republicans have criticized President Barack Obama over his efforts to close out the wars in Iraq and Afghanistan, his support for NATO’s intervention in Libya and his treatment of China’s currency, among other issues.

The Obama camp believes foreign policy offers a strong platform for the president, who left Friday on a nine-day tour of the Asia-Pacific region.

. Also onstage will be Minnesota Rep. Michele Bachmann, Texas Rep. Ron Paul, former Pennsylvania Sen. Rick Santorum and former Utah Gov. Jon Huntsman. The volatile GOP field has seen contenders surge ahead in national polls only to fall behind.