Nikki Haley, the United States Ambassador to the United Nations speaks during a meeting with US President Donald Trump speaks in the Oval office of the White House October 9, 2018 in Washington, DC.

Former United Nations ambassador Nikki Haley claims in her new memoir that two of President Donald Trump's senior advisers tried to subvert him in order to "save the country."

Former Secretary of State Rex Tillerson and former White House Chief of Staff John Kelly confided in Haley that they were trying to resist the president and encouraged her do the same, she wrote in her new book, "With All Due Respect," which comes out on Tuesday.

"Kelly and Tillerson confided in me that when they resisted the president, they weren't being insubordinate, they were trying to save the country," Haley wrote.

"It was their decisions, not the president's, that were in the best interests of America, they said. The president didn't know what he was doing," Haley wrote about the two advisers.

Haley, the former Republican governor of South Carolina, said she refused to listen to their instructions and had an obligation to carry out the president's orders since he was elected by U.S. voters. She is widely viewed as a top potential Republican contender for president, though she insists she has no immediate plans to run for any office.

"It absolutely happened," Haley said in a CBS interview that aired on Sunday. "And instead of saying that to me, they should've been saying that to the president, not asking me to join them on their sidebar plan. It should've been, 'Go tell the president what your differences are, and quit if you don't like what he's doing.'"

"But to undermine a president is really a very dangerous thing. And it goes against the Constitution, and it goes against what the American people want. And it was offensive," she said.

Tillerson also told Haley that people would die if Trump went unchecked, according to The Washington Post.

Haley has dismissed efforts by House Democrats to impeach Trump after he pressured Ukraine's president to investigate his political opponent, though she said she is against the president's actions to seek foreign aid for his own political gain.

Haley, the U.S.-born daughter of Indian immigrants, also defended Trump on his inflammatory demands that four members of Congress who are women of color should "go back" to their countries.

"No, it's not appropriate," Haley said on Sunday. "But I also can appreciate where he was coming from, from the standpoint of, don't bash America over and over and over again and not do something to try and fix it."