WASHINGTON (Reuters) - A union representing U.S. immigration and customs agents urged the Senate on Tuesday to block confirmation of President Donald Trump’s nominee to head the immigration enforcement agency, citing past racially tinged and controversial comments.

The National Immigration and Customs Enforcement Council, which represents more than 7,000 agents, endorsed Trump in the 2016 U.S. presidential election. But it opposes the Republican president’s nomination of Ronald Vitiello to head the U.S. Immigration and Customs Enforcement (ICE) agency.

A letter from union President Chris Crane to the top Republican and Democrat on the Senate Homeland Security Committee, seen by Reuters, said the nominee’s prior offensive tweets demonstrate he “lacks the judgement and professionalism to effectively lead a federal agency.”

Vincent Picard, an ICE spokesman, said on Tuesday that the Twitter posts by Vitiello were made from a private account while he was off duty, and that the Office of Special Counsel (OSC) had investigated the matter and cleared him of any wrongdoing.

“The National ICE Council’s focus on a couple of old tweets that have been investigated and addressed is a disservice to the men and women of ICE,” he said, adding that Vitiello has already made a positive impact on ICE during his brief tenure.

The Senate committee is scheduled to vote on Wednesday on whether to approve Vitiello’s nomination and send it to the full Senate for a confirmation vote.

Vitiello, a former top Customs and Border Protection official, was named as ICE’s acting director in the summer, shortly after Trump ended a contentious policy of separating immigrant children from their parents at the border.

Vitiello could face some opposition from Democrats, particularly after he refused during his confirmation hearing on Nov. 15 to rule out reinstating the child separation policy.

“We will get less people bringing their children. So it is an option,” he said at the time.

Tuesday’s letter marked the first time the union has openly opposed the nomination of any presidential appointee, the union letter said. The union broke with its parent organisation, the American Federation of Government Employees, when it endorsed Trump in 2016.

In the letter, Crane cited numerous concerns that ranged from allegations of whistleblower retaliation and lying to lawmakers during Vitiello’s confirmation process, to offensive tweets that Vitiello made while serving at Customs and Border Protection.

In one social media post, Vitiello suggested the Democratic Party should be renamed as “NeoKlanist,” a reference to the Ku Klux Klan white supremacist group, and in another Vitiello compared then-candidate Trump to the troublemaking Dennis the Menace newspaper comic character. At the time he did this, Crane wrote, Vitiello’s Twitter account showed him wearing a Border Patrol uniform.

Crane wrote that such comments violate official codes of conduct at the Department of Homeland Security and could jeopardise criminal cases that go to trial because they could be used by the defence to impeach ICE’s credibility.

“This type of conduct would result in a rank and file ICE employee being disciplined, if not possibly removed from employment,” Crane wrote.

“We are not aware that Mr. Vitiello was ever disciplined for his actions and instead of being demoted or fired, if confirmed as ICE Director, he will be promoted to the highest position in one of the nation’s largest law enforcement agencies,” the union president wrote.

The nominee told lawmakers during the hearing that his tweet about the Democratic Party was a mistake.

“I was trying to make a joke,” Vitiello said at the time, adding that he thought he was sending it as a private direct message on Twitter rather than publicly on the social media platform, and that he deeply regretted it.

Whether the union’s opposition to Vitiello could move the needle enough to block him will largely turn on how Republicans respond. Republicans hold 53 Senate seats, and only a simple majority in the 100-seat chamber is needed to approve a nomination.

Republican Senator James Lankford, a member of the Homeland Security Committee, said in a hallway interview Tuesday he has real concerns about Vitiello, but declined to elaborate ahead of the panel’s vote.

Homeland Security Committee Chairman Ron Johnson told Reuters he plans to proceed with the vote, but that he understands the union’s concerns.