SAN SALVADOR, El Salvador (AP) — America's top law enforcement officer wandered through a Salvadoran jail, sizing up the tattooed gang members who sat with their backs to him on the concrete floors of their cells. His soft voice was barely audible over the downpour pelting the tin roof as he spoke to the local police.

In the midst of a week when his role — and future — in President Donald Trump's Cabinet was in serious doubt, U.S. Attorney General Jeff Sessions could be found thousands of miles away from Washington, surrounded by concertina wire and soldiers with rifles. Belittled by his boss back home, he vowed not to loosen his grip on the job that he loves.

For Sessions, leading the Justice Department is an opportunity to make tangible progress on issues he long championed, sometimes in isolation among fellow Republicans, during two decades in the U.S. Senate: hard-line immigration policies and aggressive prosecutions of gangs, drugs and gun crime. His priorities mark a departure for a department that, during the Obama administration, increasingly focused on preventing high-tech attacks from abroad, white-collar crime and the threat of homegrown violent extremism.

Yet Sessions' policy focus is often overshadowed by the expanding investigation into Trump campaign ties to Russia. Sessions, whose own campaign contacts with Russia's ambassador to the U.S. have been questioned, has stepped aside from the investigation. That unnerved Trump, who subjected his attorney general to almost daily public humiliation this past week.

Sessions was trying to weather the storm in San Salvador, where on a balmy afternoon his attention turned to the notoriously brutal street gang MS-13, whose violence in the U.S. has become a focal point in the immigration debate. Here was the former Alabama senator, traveling El Salvador's streets in a motorcade alongside leaders of the Justice Department's criminal division, buoyed by reassurances from congressional Republicans in Washington after Trump's tirade.

The trip was planned before the firestorm, but Sessions hoped his work on MS-13 would help mend his tattered relationship with Trump.

"It hasn't been my best week for my relationship with the president," Sessions told The Associated Press. "But I believe with great confidence that I understand what's needed in the Department of Justice and what President Trump wants. I share his agenda."

Sessions cut his teeth as a federal prosecutor in Mobile, Alabama, at the height of the drug war, an experience that has shaped his approach to running the Justice Department. Allegations of racially charged remarks cost him a federal judgeship, but he went on to become the state's attorney general.

He was elected to the Senate in 1996 and developed a willingness to break with fellow Republicans in ways that sometimes left him on the sidelines.

He fought against efforts to overhaul the criminal justice system last year, a rare area where conservatives and liberals had found unity. He also was a leading opponent of the 2013 bipartisan bill that sought to ease immigration restrictions.

That issue drew him to Trump. Sessions was the first senator to endorse the businessman-turned-politician. Trump rewarded that support by naming Sessions as attorney general. It was, Sessions has said, a job that "goes beyond anything that I would have ever imagined for myself."

"In the Senate, you get paid for your words. But in the Department of Justice, every now and then you can actually take action and set priorities and see it actually take effect," Sessions told AP in an interview from inside the headquarters of Policia Nacional Civil, El Salvador's police force, where he had gone to build rapport with the commissioner. "It's kind of a real adjustment. I was a federal prosecutor for 12, 14 years, really. This is coming home to the Department of Justice I so much loved and still do. You can make things happen in the Department of Justice."

In moving quickly to put his own stamp on the Justice Department, Sessions continues to find himself at odds with both Democrats and members of his own party.

His decision this month to revive a program that lets local American police seize cash and property with federal help prompted rebuke from conservative groups such as the Koch-backed Freedom Partners, which called it "unjust and unconstitutional."

Sessions told federal prosecutors to pursue the toughest charges against most suspects, a move that critics assailed as a revival of costly drug-fighting policies. He wants a crackdown on marijuana as a growing number of states work to legalize it. His escalating threats to withhold money from cities that refuse to cooperate with immigration authorities have made city leaders only more defiant.

Timothy Heaphy, a former U.S. attorney for the Western District of Virginia who served under President Barack Obama, said the fast pace of Sessions' changes is disturbing.

"He came in clearly with an agenda to go back in time to a tough-on-crime and law-and-order approach," Heaphy said. "He's ignoring all the progress we made."

During his final years in the Senate, Sessions began to gain greater notice from the far-right. He was a favorite of Breitbart, the website previously run by Steve Bannon, who now serves as Trump's senior adviser. Other Sessions' aides also serve in top administration posts, including Stephen Miller, the architect of several of Trump's immigration proposals.

Jenny Beth Martin, co-founder of Tea Party Patriots, said Sessions has a "warrior spirit" and is working on behalf of people whose voices haven't always been heard in Congress.

"He has had to take on battles before within his own party and against the opposition party, and he takes those on and he fights them," she said.

Sessions believes he is making progress.

"A number of things we've done are just beginning to ripen," he told the AP. "I'm pretty happy with the speed with which a lot of it is happening. Sometimes the American people may not know how effective that's been."