The second presidential debate proved to be a bitter back-and-forth between Democrat Hillary Clinton and Republican Donald Trump, with insults and allegations being thrown from both camps. The town-hall style debate took on a dark tone from the get-go, with Trump threatening to appoint a special prosecutor to investigate Clinton if he wins the election.

The question that the US wanted to hear came up almost immediately. After a member of the public panel asked each candidate if they were good role models for young people, moderator Anderson Cooper questioned Trump about his lewd comments about grabbing women's genitals in a leaked videotape from 2005.

"That is sexual assault," said Cooper. "You bragged that you committed sexual assault. Do you understand that?"

"I didn't say that at all. I don't think you understood what was said. This was locker-room talk," Trump said. "Certainly I'm not proud of it. But this is locker-room talk." Twice the GOP nominee insisted that "no one has more respect for women than I do."

Cooper asked Trump if he actually carried out the acts he boasted of. "I'm very embarrassed by it. I hate it. It's locker room talk," Trump said again, then suddenly pivoted to Isis "chopping off heads," adding: "I will knock the hell out of Isis."

A deadly serious Clinton said the video made her profoundly question Trump's "fitness" to be president.

"What we all saw and heard on Friday was Donald talking about women, what he thinks about women, what he does to women, and he has said that the video doesn't represent who he is ... It represents exactly who he is," she said.

Trump's aversion to his Democratic rival became even more apparent when he threatened to jail her if he wins the race to the White House. "I didn't think I'd say this, but I'm going to say this, and I hate to say it, but if I win, I am going to instruct my attorney general to get a special prosecutor to look into your situation," Trump said, making reference to Clinton's ongoing email scandal.

The FBI, which investigated Clinton and her use of private server during her time as secretary of state, concluded she was guilty of being careless but not of committing a crime. Clinton responded: "It's just awfully good that someone with the temperament of Donald Trump is not in charge of the law in our country."

Trump, never one to miss an opportunity for a retort, quipped: "Because you'd be in jail."

When asked about Islamophobia from one of the undecided voters in the audience, Trump said the treatment of Muslims in the US was "a shame" before jumping into assertions that the Muslim community fails report radicalism. "To solve the problem, you have to be able to say what the problem is or at least say the name," he said. "The name is there. It's radical Islamic terror."

Clinton argued that the US, however, is not fighting the religion of Islam but rather radicalisation.

Trump again become the centre of attention when the moderators delved into tax reform and the recent report by the New York Times that revealed the real estate mogul may have managed to evade paying federal income tax for nearly 20 years.

The GOP nominee admitted he had avoided paying personal federal income taxes. "Of course I do, of course I do," he said. "So do all of her donors."

The real estate mogul refused to reveal how many years he avoided paying federal income tax, but argued that if Clinton had a problem with the write-offs, she should have gotten rid of them when she was senator for New York.

Clinton noted that she had tried but had been hindered by a Republican president. "I've been in favour of getting rid of carried interest for years. Starting when I was a senator from New York," she said. When Trump asked her why she did not do it, she responded: "Because I was a senator with a Republican president."

Highlights from the debate: Moderators question Trump on his hot-mic comments. He calls it "locker room talk"

Trump threatens to jail Clinton over her emails if he's elected president

Trump calls for the extreme vetting of Muslims coming to the US

GOP nominee acknowledges he has taken advantage of income tax write-offs

"We haven't spoken and I disagree," Trump responds when asked about his running mate's belief that the US should prepare to use military force if Russia continues its airstrikes in Syria

Cooper and fellow moderator Martha Raddatz worked hard to gain control of the debate and mostly succeeded when they cracked down on the candidates for exceeding time limits. Twice Cooper ordered the Republican: "Mr Trump, don't interrupt, she [Clinton] didn't interrupt you." He was admonished more than once to answer the question that he was asked.

Trump later complained about "unfair" treatment by the moderators. He missed answering a question on what action he would take in Syria if he were president, but Raddatz allowed him to finish – then asked the question all over again.

The biggest surprise was that he does not agree with running mate Mike Pence on Syria. Pence said in the vice presidential debate that the US should be prepared to take military action if Russia continued its airstrikes with the Syrian regime. "He and I haven't spoken and I disagree," said Trump.

The debate attempted to end on a high note, with an undecided voter asking Trump and Clinton to say one thing they respect about one another.

"I respect his children. His children are incredibly able and devoted, and I think that says a lot about Donald," Clinton said. "I don't agree with nearly anything else he says or does, but I do respect that, and I think that is something that as a mother and her grandmother, is very important to me."

Trump, meanwhile, applauded Clinton's determination and her spirit. He said: "She doesn't quit. She doesn't give up. I respect that. I tell it like it is. She is a fighter. I disagree with much of what she is fighting for. I do disagree with her judgment in many cases, but she does fight hard and she doesn't quit and she doesn't give up and I consider that to be a very good trait."

<iframe src="https://player.vimeo.com/video/186256529" frameborder="0" width="640" height="360">

Battle for Orlando: Who is voting for Donald Trump and Hillary Clinton in the key swing state of Florida? from International Business Times on Vimeo.