WASHINGTON — Mike Pompeo was confirmed as CIA director by the Senate on Monday, putting the conservative Kansas congressman in charge of an agency bracing for its most contentious relationship with the White House in decades.

As CIA director, Pompeo will be responsible for managing a global spying network at a time of escalating security problems, including renewed aggression by Russia and the terror threat posed by the Islamic State.

But, at least initially, Pompeo’s most vexing task may be finding a way to establish a functional relationship between the CIA and President Trump.

The new commander in chief traveled to CIA headquarters Saturday, in an effort to create a fresh start with an agency he has frequently treated with contempt. Instead, Trump aired grievances against Democrats and journalists.

Trump skipped most of the daily intelligence briefings offered him after his surprise election victory. He has dismissed the agency’s conclusions on critical issues, particularly that Russia interfered in last year’s election to help him win. Trump also accused intelligence officials of conducting a Nazi-like campaign to smear him.

Trump has expressed confidence in Pompeo, a businessman who served as an Army tank commander and graduated at the top of his class at West Point.

“Intelligence agencies are vital and very, very important,” Trump said this month.

His comments signaled that his hostility toward the agency might subside when his designated director is in charge. But CIA veterans say Pompeo may face other challenges, including whether he will be listened to at the White House and be able to insert hard data into debates presided over by a president who suggests he sees information on WikiLeaks as more reliable than intelligence briefs.

Michael Morell, the former deputy director of the CIA and a supporter of Hillary Clinton during the campaign, said that he has “come to admire” Pompeo and expects him to arrive at the CIA without preconceived notions.

“Pompeo has two key challenges: winning over a workforce a bit skeptical of him … and making the CIA’s voice heard at the Trump White House,” Morell said. “I know Pompeo, and he will succeed at the first challenge. The second will be the defining issue of his tenure.”

During his confirmation hearing, Pompeo vowed to defy Trump if ordered to direct the agency to resume brutal interrogation of terror suspects. He called the consensus of U.S. spy agencies that Russia hacked the election in part to help Trump as “sound” judgment.