Julie Pace?and Jill Colvin

DES MOINES, Iowa: Republican presidential candidates strained to take advantage of a rare opportunity to step out of Donald Trump’s shadow in Thursday night’s presidential debate, after mocking the front-runner for boycotting the final contest before voting begins.

Texas Sen. Ted Cruz, who is locked in a tight contest with Trump in Iowa, opened the debate with a sarcastic impression of the real estate mogul’s frequent insults of his opponents.

“I’m a maniac and everyone on this stage is stupid, fat and ugly,” Cruz said, before thanking his fellow candidates for showing Iowa voters respect by showing up.

Former Florida Gov. Jeb Bush, a frequent target of Trump, said with a wry smile, “I kind of miss Donald Trump; he was a teddy bear to me.”

Never one to go quietly, Trump was holding a competing rally elsewhere in Des Moines, an event his campaign said was raising money for military veterans.

“When you’re treated badly, you have to stick up for your rights,” Trump said in explaining he was skipping the debate because he felt Fox News had dealt with him unfairly. “We have to stick up for ourselves as people and we have to stick up for our country if we’re being mistreated.”

Thursday’s debate comes four days before the Iowa caucuses kick off the 2016 nominating contest. With their White House hopes on the line, the candidates moved quickly to cast themselves as best prepared to be commander in chief and take on terror threats emanating both from abroad and within the United States.

Florida Sen. Marco Rubio struck an aggressive posture, pledging that as president, he would go after terrorists “wherever they are. And if we capture them alive, we’re sending them to Guantanamo.”

Rubio also stood by his previous calls for shutting down mosques in the U.S. if there were indications that the Muslim religious centers were being used to radicalize terrorists.

Kentucky Sen. Rand Paul — back on the main debate stage after being downgraded to an undercard event because of low poll numbers earlier this month — warned against closing down mosques. A proponent of a more isolationist foreign policy, Paul also raised concerns about the U.S. getting involved militarily in Syria, where the Islamic State has a stronghold.

John Kasich said he has a record as a member of Congress and as governor of Ohio to understand Washington and bring everyone together to fix America’s biggest problems.

Kasich said he’s been “a reformer all my career.”

He says “we cannot fix things in this country — Social Security, the border, balancing the budget, getting wages to grow faster — unless we lead as conservatives.”

Speaking at his rally coinciding with the GOP debate, Trump told supporters he would have preferred to be at the debate, but had no choice but to skip it after promising a boycott.

Angry over an escalating feud with debate host Fox News, Trump bowed out of the debate and instead held what his team called a “Special Event to Benefit Veterans Organizations” at a packed 775-seat auditorium at nearby Drake University.

“When you’re treated badly, you have to stick up for your rights,” Trump told the crowd.

Trump said his foundation already had raised between $5 million and $6 million for veterans since announcing the event. He said he’s putting up $1 million of his own money and read off the names of wealthy friends he said had pledged major contributions.

Fox News Channel issued a statement saying Trump had offered to appear at the debate upon the condition that Fox give $5 million to his charities, which Fox said was not possible.