South Carolina Gov. Nikki ­Haley departed sharply and sometimes awkwardly from President-elect Donald Trump on several foreign policy issues Wednesday and told senators that as United Nations ambassador she would not hesitate to disagree with her boss.

The Republican rising star who had been critical of Trump as a candidate struggled at times to distance herself from some of Trump’s most controversial positions without openly contradicting him.

During her confirmation hearing before the Senate Foreign Relations Committee, Haley voiced heavy skepticism about Russia and optimism about NATO, both deviations from some of Trump’s statements. She unequivocally shot down the idea of a Muslim registry or ban, which Trump has never fully disavowed.

Sen. Chris Murphy (D-Conn.) put her on the spot, noting that on some issues Trump has outlined a world view that is “the exact opposite of what you are articulating it to be.”

Trump has already modified some positions, and more changes are likely once Trump is in office, she said.

“Not all of it will change after Friday, but I will control the part of it I can” at the United Nations, she said.

Later, an exchange with Sen. Christopher A. Coons (D-Del.) upped the tension in the room, as Haley suggested he direct his queries about Trump’s comments to the president-elect.

“But he’s not in front of me and you are,” replied Coons.

Wednesday’s hearing, which came after a string of others in which Trump’s nominees were at odds with him over some of his signature stances, highlighted the potential for deep discord in the new administration.

For her part, Haley framed the disagreements as a positive development.

“That’s how an administration works. You surround yourself with people who don’t just say ‘yes’ to what you think,” she said.

Haley was supposed to be one of Trump’s least-contentious choices for a top government job despite little direct experience handling the global issues and negotiations she would face as the ambassador to the United Nations.

Haley entered her confirmation hearing with the likelihood of at least some Democratic support. But the stakes for Haley rose after the problematic audition last week for the man who would be her boss — secretary of state nominee Rex Tillerson.

She pledged to forcefully advance American interests at the U.N. after what she called a retreat from global leadership under the Obama administration.

Haley questioned the priorities and effectiveness of the world body, which Trump has called a toothless debating society, but said she intends to “fix” what doesn’t work.

“I have no problem calling people out,” Haley said.

The United Nations is “often at odds with American national interests and American taxpayers,” Haley said, adding that she would use the “leverage” of potential cuts in U.S. funding to demand reform.

She expressed skepticism about working with Russia. She also said she has not had a detailed conversation with Trump about the U.S. relationship with Moscow.

“Russia is trying to show their muscle right now. It’s what they do,” Haley said. “I don’t think that we can trust them,” she added. “We have to continue to be very strong back and show them what this new administration is going to be.”

She said she agrees that Russia invaded and seized Ukrainian territory in 2014 and that U.S. and international sanctions were an appropriate response. She said she would consider additional sanctions, something Trump has suggested he may oppose.

Haley said she believed Russia’s bombing in Aleppo, Syria, constituted a war crime. Tillerson declined to call Russian President Vladimir Putin a war criminal during his hearing last week.

On Iran, the South Carolina governor said that rather than backing out of the nuclear deal that the Obama administration helped broker, the United States ought to monitor the arrangement. Trump has called the deal “dumb” and suggested that he could pull out of it.

“I think what would be more beneficial at this point is that we look at all the details of the Iran deal,” Haley said. “We see if they are actually in compliance. If we find that there are violations, then we act on those violations.”

Haley harshly criticized the Obama administration for allowing the U.N. Security Council to condemn Israel and pledged never to let it happen again if confirmed as the next U.N. ambassador.

“I will not go to New York and abstain when the U.N. seeks to create an international environment that encourages boycotts of Israel,” Haley said.

She also questioned the priorities and effectiveness of the United Nations in other areas but said she looks forward to representing the United States in the international forum. Her skepticism about the United Nations’ value echoes Trump’s and aides who have said the New York-based body is biased, bloated and ineffectual.

“We contribute 22 percent of the U.N.’s budget, far more than any other country. We are a generous nation,” Haley said. “But we must ask ourselves what good is being accomplished by this disproportionate contribution. Are we getting what we pay for?”

Haley is best known nationally for her handling of the 2015 racially motivated killings of black worshipers at a historic Charleston church, for which she got generally high marks. She spoke at memorials and ordered the Confederate flag removed from the state Capitol grounds.