Former Fox News Channel executive Bill Shine is joining the White House as assistant to the president and deputy chief of staff for communications, the White House announced Thursday.

The long-expected move follows weeks of speculation that the former Fox News Channel and Fox Business Network co-president was a front-runner for the post, which has remained vacant since former communications director Hope Hicks’s resignation in March.

In a statement, the White House said Shine “brings over two decades of television programming, communications, and management experience to the role.” He will be tasked with establishing the broader message and tone of the president’s agenda.

Shine, who started his two-decade-long career at Fox News as a producer for the show “Hannity & Colmes,” was ousted from his role as co-president last year after lawsuits suggested he enabled alleged sexual harassment by the network’s late chairman and chief executive, Roger Ailes.

Shine had recently been seen at the White House and has previously met with Trump at his Mar-a-Lago resort in Florida. He was spotted Thursday afternoon getting into Trump’s motorcade, according to CNN.

With Thursday’s announcement, Shine becomes the fifth communications chief since Trump took office nearly 18 months ago. Before Hicks, Anthony Scaramucci served 10 days in the role. He was preceded by Mike Dubke and Sean Spicer.

The move will bolster the White House’s messaging operation ahead of what is shaping up to be a fierce partisan battle over Trump’s choice for a successor to retiring Supreme Court Justice Anthony M. Kennedy, set to be unveiled on Monday. It also comes ahead of a trip by Trump next week to Europe, where one of the most closely scrutinized items on the agenda will be the president’s one-on-one summit with his Russian counterpart, Vladi­mir Putin.

Yet the appointment is also likely to open the White House up to attacks regarding Shine’s record at Fox, as well as the Trump administration’s response to sexual misconduct allegations against officials within its own ranks. During his time at Fox, Shine helped to build the network into the media juggernaut it is today. But much like his mentor and patron, Ailes, Shine’s long tenure was clouded by unsavory allegations and associations with darker chapters in the network’s history. Ailes died in May 2017.

Trump himself has been accused of sexual harassment and improper behavior by more than a dozen women, accusations which he denies. And earlier this year, White House staff secretary Rob Porter resigned amid reports that he had physically and emotionally abused his two ex-wives.

Donald Trump Jr., the president’s eldest son, was among those cheering Shine’s hiring on Thursday — while also anticipating a backlash from the left.

“On your marks, get set.... how long till the liberal media and snowflakes start taking shots at the great Bill Shine?” he wrote on Twitter. “Competent, hard working and a believer in making America great again!”

Angelo Carusone, president of the left-leaning group Media Matters for America, said in a statement that it was “no surprise that the White House selected someone who has Sean Hannity’s personal seal of approval.”

He described Shine as having been “at the helm of Fox News as it transitioned from being a partisan political operation to a pro-Trump propaganda arm” and as having “enabled serial sexual misconduct for years.”

For decades, the daily “message” was Ailes’s job at Fox, and Shine was his dutiful lieutenant. While Ailes focused on the big picture — how to frame the day’s events, who to attack or support — Shine managed the details of running the network. He also managed some of Fox’s biggest stars, most notably Hannity, a close confidant with whom Shine sometimes vacationed. The prime-time host set Shine on his path to the top at Fox. It was Hannity, too, who helped broker Shine’s new White House job, according to people familiar with the discussions.

The presidential appointment reunites Trump with Shine, who gave the then-businessman and reality TV star copious airtime on Fox to opine on a range of subjects. Among them was a regular slot on “Fox & Friends,” on which Trump often promoted his false claim that President Barack Obama was not born in the United States. The weekly appear­ances helped burnish Trump’s political credentials, at least with more than a million viewers of the morning program.

Shine has spent the past 14 months off the public grid after his ouster from Fox last May. He briefly succeeded Ailes as the network’s top executive after Ailes was driven out by sexual harassment allegations, including a lawsuit by former host Gretchen Carlson, which Fox’s parent company settled in mid-2016 for $20 million.

Shine himself was never directly accused of harassment at Fox. But his latter years at the network were pockmarked by his association with Ailes, especially accusations that he helped facilitate Ailes’s predatory behavior. Shine has consistently denied wrongdoing.

He also was part of Fox’s senior management during the period in which the network was paying millions of dollars in settlements to former employees who had accused Ailes and host Bill O’Reilly of harassment.

He was named in suits filed by Carlson and former network contributors Julie Roginsky and Andrea Tantaros for his role in allegedly discouraging women at the network from taking their harassment claims to court. Roginsky, who said Ailes sexually harassed her, accused Shine of retaliating against her for her refusal to join “Team Roger,” a cadre of women who supported Ailes in his battle with Carlson. Shine denied those allegations.

He also allegedly played a role in covering up Ailes’s relationship with Laurie Luhn, a former Fox booker who claimed she had a long, abusive affair with Ailes that eventually led to her mental breakdown. Luhn received $3.1 million from Fox in 2011 to settle her allegations of abuse and mistreatment by Ailes.

Shine’s appointment by Trump on Thursday brought swift rebuke from attorney Nancy Erika Smith, who represented Carlson and Roginsky in their suits against Ailes.

“Roger Ailes’s enabler and confidant is well qualified to speak on behalf of a president who brags about assaulting women and preying on teenage beauty pageant contestants, and pays adult film actresses to be quiet about his adultery,” Smith said. “Being from Fox News, Shine is also well qualified to speak for a president who lies every single day.”

Josh Dawsey and John Wagner contributed to this report.