The Republican convention erupted in fury Wed­nesday night when a defiant Ted Cruz refused to endorse Donald Trump and instead urged people to “vote their conscience.”

Members of the New York delegation began furiously chanting, “Endorse!” and “We want Trump!” even before Cruz finished, when it became apparent he was stabbing the GOP nominee in the back to position himself for a potential 2020 White House run.

Cruz paused, smiled and responded snidely, “I appreciate the enthusiasm of the New York delegation.”

Trump’s family sat stone-faced and Trump himself walked into the arena at the tail end of Cruz’s speech, stealing the Texas senator’s thunder as the crowd kept booing Cruz and cheering the nominee.

“He’s a disgrace and a liar. He’s a self-centered liar and fraud. Lying Ted,” Long Island Rep. Peter King said of his congressional colleague.

“I never trusted him. I’ve never liked him and I think he’s disqualified himself from ever being considered as the Republican nominee for president.”

A man in the donor suite was so angry, he had to be prevented from attacking Cruz after the senator’s speech, and Cruz’s wife, Heidi, had to be escorted to safety, according to CNN.

“Some people on donor suite level so angry at @tedcruz they called him disgrace to his face; one man had to be restrained,” the network’s Dana Bash tweeted.

“HEIDI CRUZ escorted out by security as crowd gets angry at Cruz for his speech. One Trump supporter shouting ‘Goldman Sachs!’ ” at her, CNN’s Manu Raju tweeted, a reference to loans the Cruz campaign took from the banking giant, where Heidi was once an investment manager.

Later, Trump said he knew about the content of the Cruz speech but let the Texas senator take the stage anyway.

“Wow, Ted Cruz got booed off the stage, didn’t honor the pledge!” Trump tweeted. “I saw his speech two hours early but let him speak anyway. No big deal!”

During the speech, Cruz spelled out his own values in an attempt to position himself as the leader of the conservative movement and as the leading GOP presidential candidate in four years, should Trump lose the ­November general election.

“Ted Cruz is an a–hole!” yelled infuriated North Carolina alternate delegate Laurie Powell, a former Cruz supporter.

“He’s not our nominee. What he needed to do tonight was get behind our nominee. He put himself above the party. Ted Cruz’s political career is over and done.”

It was Cruz’s final comments that set the crowd off. “Stand and speak, and vote your conscience. Vote for candidates up and down the ticket who you trust to defend our freedom and to be faithful to the Constitution,” he said.

Meanwhile, Trump gave an interview to the New York Times Thursday in which he said that as president, he might not automatically defend America’s NATO allies if they were attacked.

Trump’s campaign later said he had been misquoted.