NORTH CHARLESTON, S.C. — Donald J. Trump and Senator Ted Cruz of Texas sharply attacked each other on Thursday night over the Canadian-born Mr. Cruz’s eligibility to be president and Mr. Trump’s “New York values,” shedding any semblance of cordiality as they dominated a Republican debate less than three weeks before the Iowa caucuses.

Their exchanges showcased the intense and unpredictable new phase of the race as polls tighten and 11 candidates jockey for political advantage — not only over issues like imposing tariffs on Chinese goods and fighting the Islamic State, but also over matters of character and integrity that drew some of the hardest punches of the race so far.

In many ways, it was the darkest debate of the campaign, as the Republicans tried to paint the grimmest possible portrait of an America in decline economically, despite rapid job growth, and militarily, though they praised service members. The ferocity onstage reflected the pressure in the race as it distills into a contest between the anti-establishment Mr. Trump and Mr. Cruz, followed by other candidates like Senator Marco Rubio of Florida and Gov. Chris Christie of New Jersey.

Mr. Rubio and Mr. Christie, along with Jeb Bush and John Kasich, are vying to emerge as the leading candidate of mainstream Republicans, yet they struggled to be heard on Thursday night.