Updated April 23, 2015, 2:05 p.m.

Loretta Lynch won confirmation as attorney general on Thursday afternoon, as the Republican-controlled Senate gave its approval after a wait of 166 days. The final vote was 56-43, with 10 Republicans joining all Democrats in supporting her.

Lynch, 55, had been serving as the U.S. attorney in Brooklyn when Obama chose her in November to become the first African American woman to lead the Justice Department. Holder had announced his intention to resign last September after serving as attorney general for the entirety of Obama's presidency.

While most Republicans did not dispute Lynch's qualifications, they took issue with her support, during her confirmation hearing, for Obama's unilateral actions on immigration. But the delay in her confirmation—the third-longest for any attorney general nominee in history—actually had little to do with her: Senate Majority Leader Mitch McConnell made her wait until the Senate resolved an unrelated abortion dispute in an anti-trafficking bill, which passed on Wednesday. McConnell ended up voting in favor of her nomination on Thursday. Lynch is now the second Obama Cabinet nominee to be confirmed by the new Republican majority in the Senate, which overwhelmingly approved Ashton Carter to be defense secretary in February.

Updated April 21, 2015, 11:24 a.m.

Loretta Lynch will finally get a Senate vote this week on her nomination to be attorney general, five-and-a-half months after President Obama chose her to succeed Eric Holder.

The long-delayed vote will come after Senate leaders struck a deal on completely unrelated anti-trafficking legislation and as Republicans faced mounting pressure from within their own ranks to confirm her. While her eventual approval had been expected, Lynch had become entangled in the Senate's partisan wringer, with Mitch McConnell refusing to call a vote until Democrats relented on abortion language in the otherwise non-controversial trafficking bill.

On Tuesday, McConnell and Harry Reid, the minority leader, announced an agreement that, at first glance, appears to be a genuine compromise. The trafficking measure creates a fund for victims, and Democrats had protested when Republicans added language explicitly prohibiting any of the money from paying for abortions. They argued that this would amount to a significant expansion of the  Hyde Amendment, which for four decades has prevented taxpayer dollars from funding abortion. Under the compromise, the revenue for the fund will be split into criminal fees that can go to legal aid and law enforcement but not healthcare, while money appropriated by Congress—and subject to the Hyde restrictions—can pay for health and medical services. Like most compromises, it allows both sides to claim success. Republicans have prevented either pot of funds from paying for abortions, by preventing criminal fees from paying for any healthcare. Democrats have limited the application of the Hyde Amendment to taxpayer dollars, halting the effort to expand it to other sources of funding.

The real payoff for Democrats, however, is that Lynch will get a vote after waiting longer than any nominee for attorney general in the last 30 years. Obama had denounced the delay as "embarrassing" to the Senate, and even Republican onlookers in recent weeks wondered why the party was holding up a nominee whose qualifications were never in dispute. The delay was particularly curious given that it only extended the tenure of Holder, a frequent target of conservative criticism. Rudy Giuliani, the former New York mayor, had lobbied for Lynch's confirmation; Jeb Bush said last week that Republicans should just go ahead and confirm her, despite his opposition to her support for Obama's immigration policy; and yesterday, former Attorney General Alberto Gonzales called for Lynch to have a vote.

The margin is expected to be close, but Lynch appears to have secured at least 51 votes, just enough to win confirmation without relying on Vice President Biden to cast a tie-breaking vote. (Republican opposition has centered not on her tenure as the chief federal prosecutor in Brooklyn but on her endorsement of the president's unilateral move to shield immigrants from deportation.) More broadly, the agreement is the latest sign that the logjam in Congress may finally be breaking after a slow start to the new Republican majority—at least to a limited extent. In the last several weeks, lawmakers have approved a significant change to Medicare policy and an extension of the Children's Health Insurance Program, and they have announced bipartisan agreements on trade and on Iran policy. Confirming a scandal-free attorney general shouldn't count for much, but given the recent dysfunction in Congress, it represents significant progress.