Native American groups have long objected to President Trump’s use of the nickname “Pocahontas” to deride one of his political foes, Sen. Elizabeth Warren (D-Mass.).

But even at a White House event specifically intended to honor the World War II Navajo code talkers — the heroic Native Americans who helped the U.S. Marines send coded messages in the Pacific Theater — Trump couldn’t resist.

“I just want to thank you because you’re very, very special people,” Trump said Monday afternoon, speaking to a small group of code talkers. “You were here long before any of us were here. Although we have a representative in Congress who, they say, was here a long time ago. They call her ‘Pocahontas.’ ”

Trump’s reference — unrelated to the ceremony and widely considered an offensive racial slur — seemed to catch the code talkers off-guard, prompting polite smiles and silence. The scene played out in front of a portrait of President Andrew Jackson, who signed into law the Indian Removal Act.

Mihio Manus, a spokesman for the president and vice president of the Navajo Nation, said that while “we’re very appreciative of President Trump honoring the code talkers first and foremost,” he thought Trump’s comments about Warren were inappropriate.

A portrait of President Andrew Jackson is displayed as a Navajo World War II veteran speaks during an event honoring Native American “code talkers” at the White House. (Oliver Contreras/Bloomberg News)

“It’s unfortunate that President Trump would refer to Sen. Elizabeth Warren as Pocahontas in a joking way,” Manus said. “Pocahontas, although she wasn’t Navajo, definitely was a historical figure in the foundation of this nation who is misrepresented in history. And so we as the Navajo Nation don’t feel any member of any tribal nation should be used as the punchline of a joke.”

When asked about the Jackson portrait, Manus said, “It’s unfortunate.”

On Tuesday, Sen. John McCain (R-Ariz.), a Vietnam War veteran and frequent critic of the president, similarly expressed dismay at Trump’s comments.

“Our nation owes a debt of gratitude to the Navajo Code Talkers, whose bravery, skill & tenacity helped secure our decisive victory over tyranny & oppression during WWII,” he wrote on Twitter. “Politicizing these genuine American heroes is an insult to their sacrifice.”

Trump’s feud with Warren developed during 2016 presidential campaign, where Warren took to social media to mock and needle Trump, calling him everything from a “loser” to a xenophobic “bully.” In response, Trump quickly seized upon Warren’s claims of Cherokee and Delaware Indian ancestry, which were a flash point in her Senate race in 2012, and coined a belittling nickname — “Pocahontas.”

On Monday, after the Pocahontas quip, Trump put his hand on one of the Navajo guests and said: “But you know what, I like you because you are special. You are special people.”

Sen. Elizabeth Warren D-Mass.) addresses the 2017 Center for American Progress Ideas Conference in May. (Melina Mara/The Washington Post)

Warren chastised the president for his language in an interview with The Washington Post.

“This was supposed to be a ceremony honoring war heroes,” Warren said. “All he had to do was smile and thank them for their incredible service. But he couldn’t make it through the ceremony without throwing in a racial slur. He thinks he’s going to shut me up? It’s not going to work.”

Asked about Trump’s comments at the daily news briefing, White House press secretary Sarah Huckabee Sanders said that being offensive or using a racial slur was “certainly not the president’s intent,” and instead she sought to blame Warren.

“I think what most people find offensive is Senator Warren lying about her heritage to advance her career,” Sanders said. “I think that Senator Warren was very offensive when she lied about something specifically to advance her career.”

Sanders ignored a shouted question about the Jackson painting as she exited the briefing room.

Laura Tohe, the daughter of a Navajo code talker and a professor at Arizona State University who has written a book about the heroes, said it is “huge” that the code talkers were honored at the White House. But, she said she was dismayed by Trump’s remarks during the ceremony.

“The whole idea of using this platform to make a disparaging remark about Senator Warren was inappropriate and disrespectful,” Tohe said.

Tohe’s father, who died in 1985, and other young Navajo men were recruited by the Marine Corps to send messages in the Pacific. Japanese cryptographers were unable to decipher the code, which helped the United States.

Stephanie Fryberg, a professor of psychology and American Indian studies at the University of Washington, said she was aghast to see the ceremony in front of a portrait of Jackson and to hear Trump say “Pocahontas” again.

“Rather than really honoring those veterans he took advantage of their presence to make yet another demeaning remark about Senator Warren,” she said. “Why invite those honorable men to the White House if you can’t treat them with respect?”

Jacqueline Pata, executive director of the National Congress of American Indians, said only three of the 13 surviving code talkers could make it to the White House. They are in their 90s and “were so excited about being able to participate in this event and to be there,” she said.

Pata said her organization has “tried to educate those within the White House” about using the name “Pocahontas” in a derogatory way. The event, she said, was held to honor both Native American History Month and Veterans Day.

Pata said she is concerned that the president’s remarks will overshadow the enormous contribution the code talkers made to American history.

“They turned the tide in the war,” she said. “It’s well-documented that they made the difference, and I don’t want us to forget that.”

James Hohmann and John Wagner contributed to this report.