A military analyst came under fire Thursday for saying on Fox Business that ailing Sen. John McCain cracked under torture while he was held prisoner in Vietnam — and called that proof that torture works.

The tasteless remark followed McCain’s statement that he would vote against President Trump’s nominee to head up the CIA, Gina Haspel, because he feared she would revive the harsh interrogations methods used to fight al Qaeda.

“Well she can’t use it anymore because we have determined in Congress that it’s not legal. The fact is, is John McCain — it worked on John. That’s why they call him ‘Songbird John,’ ” retired Air Force Lt. Gen. Thomas McInerney said on the show “Making Money” on Fox Business during a discussion with host Charles Payne.

“The fact is those methods can work, and they are effective, as former Vice President Cheney said. And if we have to use them to save a million American lives, we will do whatever we have to.”

McCain remained at home in Arizona battling brain cancer as Wednesday’s debate on Haspel’s nomination turned to the past use of enhanced interrogation techniques, now banned, that Trump has suggested perhaps should return.

There is no evidence that McCain, a Navy pilot who was tortured in captivity during the war, ever cooperated with the enemy.

In a statement, he praised Haspel but explained his reasons for not supporting her.

“I believe Gina Haspel is a patriot who loves our country and has devoted her professional life to its service and defense,” he said.

“However, Ms. Haspel’s role in overseeing the use of torture by Americans is disturbing. Her refusal to acknowledge torture’s immorality is disqualifying. The Senate should exercise its duty of advice and consent and reject this nomination.”

McInerney was quickly attacked on Twitter for his comments on Wednesday night’s show.

“A retired USAF three-star general, Thomas McInerney — a birther crank — just referred to former POW John McCain as ‘Songbird John’ on FOX Business. Don’t tell me not to question the patriotism of people who talk like this,” wrote Tom Nichols, a professor at the Naval War College.

“To @MeghanMcCain: A horrific man, Thomas McInerney, is spreading the lie on @FoxNews that your father cooperated under torture. He even used the ‘name’ from an anonymous 2008 poster. Slam this guy. Your father, @SenJohnMcCain, is a hero. McInerny isn’t fit to kiss his shoes,” added author Kurt Eichenwald, addressing his comment to McCain’s daughter, who did not comment on McInerney but slammed Haspel’s nomination.

Payne issued an apology on Thursday, saying he “did not catch this remark” immediately during the show.

“This morning on a show I was hosting, a guest made a very false and derogatory remark about Senator John McCain. At the time, I had the control room in my ear telling me to wrap the segment, and did not hear the comment,” he tweeted.

“I regret I did not catch this remark, as it should have been challenged. As a proud military veteran and son of a Vietnam Vet these words neither reflect my or the network’s feelings about Senator McCain, or his remarkable service and sacrifice to this country.”