Labor Secretary Alexander Acosta stands by as President Trump announces Acosta’s resignation. (Jabin Botsford/The Washington Post)

Alexander Acosta was an accidental member of President Trump’s Cabinet — and he proved to be an uncomfortable fit with the disruptive, flashy style of an administration bent on shaking things up.

He came to the Trump transition team in 2017 with impeccable, if mainstream, Republican credentials as an assistant attorney general in the George W. Bush administration and a former U.S. attorney. He was a Latino in a Cabinet lacking diversity.

When Trump’s first choice for labor secretary, fast-food executive Andrew Puzder, was forced to pull out over several personal and professional controversies, then-White House counsel Donald McGahn brought Acosta’s name to the president and vouched for him as a fellow member of the hard-right Federalist Society.

But Acosta, 50, who resigned Friday over his controversial handling of a 2008 plea deal over sex crimes involving the financier Jeffrey Epstein, quickly ran afoul of the constituencies that matter to Trump conservatives.

By contrast, Deputy Labor Secretary Patrick Pizzella, a hard-liner whom Trump named as acting secretary on Friday, is expected to follow an agenda that closely matches the White House’s.

Acosta, who aspired to be a federal judge, had a strategy as secretary to play a safe, inside game running the Labor Department, according to multiple current and former administration officials. He aimed for a balance in his approach to labor policy that would satisfy the White House — while also placating union leaders and Democrats on Capitol Hill.

But industry grew frustrated with what its leaders felt was his foot-dragging on rolling back Obama-era labor rules that were hurting their bottom line.

When Mick Mulvaney became acting White House chief of staff early this year, he was receptive to their pleas — and Acosta was on the defensive. And during the most turbulent week of his career, the secretary was left with few friends in the White House, senior administration officials said.

This account of Acosta’s tenure was confirmed by current and former Trump and Obama administration officials and industry officials, some of whom spoke on the condition of anonymity to discuss sensitive personnel issues.

Acosta enjoyed 18 months with a relatively low profile at an agency that enforces federal laws covering millions of employers and workers, yet typically flies under the radar in Republican administrations.

He had an amicable, if not close, relationship with the president, frequently flattering him in private and public, and touting Trump’s success in maintaining a strong economy and good job numbers. Acosta forged an alliance with the president’s daughter and senior adviser, Ivanka Trump, who was pushing an industry-led apprenticeship program to train future workers.

At the department’s Occupational Safety and Health Administration, Acosta rescinded a record-keeping rule that required companies to submit employee injury and illness data. He moved to strip key provisions of an Obama-era rule to limit workplace exposure to beryllium, a toxic substance that has exposed shipyard and construction workers to health dangers; businesses complained that the rule was burdening them.

He had a setback early on when a Bloomberg Law report revealed that agency officials had withheld an unfavorable report showing that workers would stand to lose billions of dollars in tips if a proposed rule was enacted. It would have allowed employers to pool the gratuities of minimum-wage workers and split them with nontipped ones.

Acosta eventually reached a compromise with Senate Democrats on legislation that prevents employers from being able to pocket workers’ tips. But the incident cemented the secretary’s suspicion of his career staff, according to two former Labor Department officials.

His labor agenda was largely driven by outside forces: court rulings that prompted him to take action, as well as pressure from unions and, eventually, from an angry White House.

Puzder, a hard-line conservative who had pledged aggressive rollbacks of Obama rules, had set high expectations among conservatives that Trump would enact a pro-business labor agenda.

Acosta — measured, deliberate, amicable — was at first inscrutable.

He had an unusual working style that colleagues privately called “no fingerprints.” He would orally dictate drafts of rules and policies to his political staff, never putting instructions in an email.

He was slow to enact rules on overtime pay and other deregulatory actions, having his staff tell White House officials that they were in the pipeline but hampered by a shortage of experts. The industry-certified apprenticeship program favored by Ivanka Trump, but opposed by the building trades, seemed to be on the back burner.

After the department’s mine safety agency eased enforcement of a key worker safety rule against a West Virginia coal mine where inspectors had found substantial safety violations, Acosta dressed down David Zatezalo, assistant secretary of labor for mine safety, two former administration officials said.

Zatezalo’s mistake, Acosta told him, was in making him look weak on enforcement.

“He was trying to look like a balanced guy, but he was acting more like a judge than a Cabinet secretary, saying, ‘I’m going to call balls and strikes when they come to me,’ ” said Seth Harris, a former deputy labor secretary under President Barack Obama who is now an attorney advising clients on labor policy.

Two Acosta allies defended his pace as deliberative and said he worked hard to enact policies that could withstand judicial scrutiny. “He’s a good and thoughtful lawyer,” said a Labor Department official, who was not authorized to speak on the record. “His view of deregulation has always been to look at what puts a rule in the best possible position to survive a court opinion.”

Deregulation experts noticed that few wins were coming out of the Labor Department.

“The high-profile deregulatory actions from the administration were coming from elsewhere,” said James Broughel, a senior research fellow at the Mercatus Center at George Mason University, a free-market research center aligned with the White House on deregulation policy.

“It made you wonder what was going on,” Broughel said. “The political personnel should be able to enact their agenda.”

At the department’s Frances Perkins Building in downtown Washington, Acosta was alienating some of his top political appointees with his inaction, and some of them started to trickle out of the administration.

Nervous about leaks, he became less accessible to his career staff, in recent months closing off his suite of offices, an action first reported by Bloomberg News.

When an investigative series in the Miami Herald late last year renewed scrutiny of Acosta’s role as then-U.S. attorney in what critics called a lenient plea deal for Epstein in Florida in 2008, Acosta’s standing weakened. Some Democrats publicly questioned the deal and called for his resignation.

But the labor movement was largely silent on Acosta’s handling of the Epstein case, underscoring the inroads he had made. The AFL-CIO’s governing council voted not to take a public position.

Meanwhile, business leaders finally found a sympathetic ear in Mulvaney, whose predecessors, Reince Priebus and John F. Kelly, had engaged little with the Labor Department.

Mulvaney, a conservative former congressman from South Carolina, told Acosta and his staff that they had to move faster on rolling back regulations. He eventually forced out Acosta’s chief of staff, Nick Geale, whom White House officials believed misled them on the pace of rule rollbacks. The firing was widely seen in the White House as another warning to Acosta.

Under pressure from Mulvaney, Acosta quickly proposed a rule increasing exemptions for overtime pay for white-collar workers and another limiting companies’ liability for unfair labor practices. Mulvaney continued until this week to maintain a tight rein over the secretary’s rule-cutting pace, according to administration officials.

Rep. Rosa L. DeLauro (Conn.), a leading Democratic voice in Congress on worker issues, said in an interview that Acosta “hollowed out” the Labor Department with “anti-worker policies.”