Here are key moments from the face-off between Republican vice-presidential candidate Mike Pence and Democratic rival Tim Kaine at Longwood University in Farmville, Va. (Sarah Parnass/The Washington Post)

The two vice-presidential candidates got into a bitter exchange about an excerpt from the speech that launched Donald Trump’s presidential campaign, in which Trump said that undocumented immigrants from Mexico were “rapists” and “bringing crime.”

“He’s not a polished politician, like you and Hillary Clinton,” said Gov. Mike Pence (Ind.), Trump’s running mate, in the only vice-presidential debate of the season.

“He is showing you who is he is,” said Sen. Tim Kaine (Va.) a few moments later, saying that Trump’s comments about Mexicans showed his true character.

“Senator, you whipped out that Mexican thing again,” Pence said. It was, indeed, one of several times that Kaine had brought up that remark – a calculated effort, playing to Hispanic voters.

“Can you defend it?” Kaine interrupted.

Republican vice-presidential candidate Gov. Mike Pence called Russian leader Vladimir Putin "small and bullying" but also that he was "stronger on the world stage" than President Obama. (Gillian Brockell/The Washington Post)

“Look, there are criminal aliens in this country,” Pence said, essentially repeating Trump’s argument that crime brought by immigrants justified a strong, blunt statement about immigrants as a whole.

Kaine pressed him further, interrupting as he had all Tuesday night.

“He also said, ‘And many of them are good people,’ and you keep leaving that out of your quote,” Pence said.

This had been the full quote from Trump: “When Mexico sends its people, they’re not sending their best. They’re not sending you. They’re not sending you. They’re sending people that have lots of problems, and they’re bringing those problems with us. They’re bringing drugs. They’re bringing crime. They’re rapists. And some, I assume, are good people.”

The year’s only vice-presidential debate was an unexpectedly contentious affair, in which Kaine tried — too aggressively at times — to make Pence defend the unorthodox views of his running mate. Pence seemed far more confident, but he was often reduced to accusing Kaine of lying about what Trump had said.

Before that exchange about Trump and Mexicans, the two running mates had traded attacks about the charitable foundations run by Clinton and Trump.

Pence accused Clinton and her husband, former president Bill Clinton, of designing their Clinton Foundation as a way to skirt laws against foreign governments making political contributions.

“While she was secretary of state, the Clinton foundation accepted tens of millions of dollars from foreign governments, and foreign donors,” he said. “The Clintons figured out a way” around the laws, Pence said, while accusing Clinton of showing favoritism toward foundation donors while she was secretary of state.

Kaine sought to defend the Clinton Foundation by saying that it had done valuable charitable work around the world — and that Clinton herself had been cleared of any wrongdoing by a State Department inquiry.

Kaine, in turn, attacked Trump’s charity — the Donald J. Trump Foundation — for giving a prohibited political gift in 2013, when it sent $25,000 to a campaign committee supporting Florida Attorney General Pam Bondi (R). The Trump Foundation then filed paperwork with the IRS that omitted any mention of that gift, and in its place listed a nonexistent gift to a different group with a similar name.

“The foundation was just fined for illegally contributing foundation dollars to a political campaign,” Kaine said. “They tried to hide it by disguising it as somebody else.”

Earlier Pence attacked Russian president Vladimir Putin as a “small and bullying leader” — a sharp break from Trump’s own attitude toward Putin, which has been warm and conciliatory.

“The small and bullying leader of Russia is not dictating terms to the United States,” Pence said. “We have got to be able to lean into this with strong, broad-shouldered American leadership.”

Pence went on to call for U.S. military strikes against a key Russian military ally, the regime of Syrian leader Bashar al-Assad, if Assad’s regime threatened to move against a besieged rebel enclave around Aleppo, Syria.

“The provocations by Russia need to be met with American strength,” Pence said. “The United States of America should be prepared to use military force to strike military targets of the Assad regime.”

Kaine raised the issue of Trump’s praise for Putin.

“If you don’t know the difference between dictatorship and leadership, then you’ve got to go back to a 5th-grade civics class,” Kaine said.

After its first hour, the debate between Kaine and Pence was defined by frequent interruptions by Kaine, and — from Pence — a calm, confident disdain, and a constant struggle to reconcile his positions with those of Trump himself. Earlier in the evening, Pence seemed to back away from a key piece of Trump’s policy agenda during the Republican primaries, a plan to deport undocumented immigrants en masse.

“In all six cases, he’s refused to defend his running mate…and yet, he’s asking everybody to vote for somebody that he cannot defend,” Kaine said at one point.

On immigration, Pence, instead, said that Trump would focus first on ending illegal immigration and deporting “criminal aliens.”

“Once we have accomplished all of that…Then we’ll deal with those that remain,” Pence said, while giving no more details. Trump said repeatedly during the GOP primary that he wanted to immediately deport 11 million immigrants already in the United States.

Kaine tried to tie Pence to Trump’s past statements, saying that “Donald Trump believes in deportation nation. You’ve got to pick your choice.”

“That’s nonsense,” Kaine said. “It’s nonsense.”

Moderator Elaine Quijano pressed Pence to say if he would follow through on Trump’s previous mass-deportation plan. Pence did not answer directly. Instead, he said he would seek to work with Democrats to work on an undisclosed answer: “Senator, I’ll work with you when you go back to the Senate,” he said to Kaine.

While Pence seemed to pivot on Trump’s immigration priorities, he stuck with Trump’s stance on taxes. Pence did not challenge the notion that his running mate had not paid federal income taxes — saying that Trump had used the tax code “brilliantly.”

Pence was asked about a New York Times report, which relied on leaked pages from Trump’s 1995 tax returns, which showed that Trump had claimed a $916 million loss — and might have been able to avoid federal income taxes for up to 18 years. Pence did not make any claim that Trump had paid federal income taxes.

“His tax returns showed he went through a very difficult time, but he used the tax code the way it was meant to be used, and he used it brilliantly,” Pence said. “Donald Trump has created tens of thousands of jobs, and he’s paid payroll taxes, property taxes….”

Kaine of Virginia challenged Pence to say why Trump had not released his tax returns, as other nominees have for 40 years. Pence repeated what Trump has said — that he would release the tax returns, but only when an IRS audit is over. The IRS has said that there is no legal prohibition on releasing taxes while they are under audit.

The two candidates spent the debate’s first half-hour using sharply different strategies: Kaine was aggressive, interrupting and hurling pre-rehearsed insults at Pence. Pence was calmer, counter-punching with an edge of disdain for Kaine’s tactics.

“People at home cannot understand either one of you when you speak over each other,” moderator Quijano said at one point, frustrated that the two men would not let one another talk.

Earlier, Kaine opened the debate by saying he was “scared” of the prospect that the GOP nominee would become president, while his son is serving in the Marine Corps.

“We trust Hillary Clinton as president and commander-in-chief,” Kaine said, speaking of himself and his wife. “The thought of Donald Trump as commander-in-chief scares us to death.”

Kaine began the debate, held in Farmville, Va., on the attack. He turned two of the first answers from questions about himself or Clinton into attacks on Trump.

“I can’t imagine how Gov. Pence can defend the insult-driven, selfish, me-first style of Donald Trump,” Kaine said.

The debate, which pitted two nominees with vanilla reputations, turned quickly bitter, with both Kaine and Pence interrupting each other.

“Senator, you and Hillary Clinton would know a lot about an insult-driven campaign. It really is remarkable,” Pence said.

After being interrupted by Kaine again, Pence responded in a flat tone that belied the bitter tone of the debate. “I musta hit a nerve here,”he said.

“You are Donald Trump’s apprentice,” Kaine said at one point, implying that the famously genial Pence had taken on Trump’s aggressive persona.

It seemed clear that Kaine had come armed with pre-planned zingers that mocked Trump, with varying degrees of zing.

“Do you want a ‘You’re hired’ president under Hillary Clinton, or do you want a ‘You’re fired’ president, under Donald Trump,” Kaine said.

Pence mocked that: “You used that a lot, and I think your running mate used a lot of pre-planned lines.”

The debate began a few minutes after 9 p.m. at Longwood University. The debate came at a moment when the Democratic ticket, led by Clinton, seems to be pulling away and at a troubling time for Trump.

He is reeling from a tumultuous performance in his first debate with Clinton last week, his attacks on a Latina beauty queen, his hostile 3 a.m. outbursts on social media and new revelations about his taxes.

Trump spent Tuesday morning in Denver, where he met privately with energy company executives. He then traveled to Arizona for an afternoon rally in Prescott Valley. Trump sent his “best wishes” to Pence ahead of the debate and said the evening contest will be “a contrast” between “our campaign of big ideas and solutions” and the “small and petty Clinton campaign that is totally stuck in the past.”

Trump was watching the debate while out west and was live tweeting his reactions.

Historically, voters have tuned into vice-presidential debates to see whether the candidates — Sarah Palin, Dan Quayle and John Edwards, to name a few — appear prepared for the presidency should the need arise.

But Pence and Kaine seem to have met the governing threshold already with their seasoned tenures in elected federal and state offices. On the Republican ticket, for instance, Pence is more qualified for the presidency by traditional standards than Trump.

Clinton said at a press conference in Harrisburg, Pa., on Tuesday that she had not spoken to Kaine that day but the two have emailed and plan to talk when the debate is over.

“I know how intense it is to prepare for a debate,” Clinton said. “I don’t want to interrupt his rhythm by calling.”

Clinton said Kaine is “ready to go toe to toe with Mike Pence on all the issues that matter to Americans” and that Pence “has a huge burden defending his own record and the record of Donald Trump.”

The debate’s setting in Farmville — which was chosen long before Clinton and Trump picked their running mates — gives the former Virginia governor a home-field advantage. Farmville was the epicenter of Virginia’s civil rights struggle, a point of resonance for Kaine, a former civil rights lawyer and the son-in-law of former governor Linwood Holton, who helped integrate Richmond’s schools in the 1970s. The state’s emergence from its segregationist past as a diverse economic powerhouse may give Kaine a dramatic backdrop against which to criticize Trump’s nationalist agenda and racially charged statements.

Tuesday will be the first face-to-face meeting for Kaine and Pence. When Kaine served as Virginia’s governor, Pence was working on Capitol Hill as a congressman. They switched places in 2013, with Pence becoming Indiana’s governor and Kaine joining the Senate.

“We talked by phone once, but I never met him,” Kaine said in a recent interview. “He called and said, ‘Hey, welcome aboard.’ He had been on the ticket a week before me.”

Both No. 2’s have their future careers to consider during their turn Tuesday before what could be a national television audience of tens of millions. Pence, 57, has an eye on a possible 2020 presidential run, should Trump lose, while Kaine, 58, also has national ambitions four or eight years from now.

Philip Rucker, Abby Phillip, Sean Sullivan and John Wagner contributed to this report.