The Senate unanimously passed legislation Wednesday to help the victims of human trafficking, ending a tortuous partisan standoff over abortion that also delayed confirmation of President Barack Obama's attorney general nominee.

The vote was 99-0 to approve the Justice for Victims of Trafficking Act, which expands law enforcement tools to target sex traffickers and creates a new fund to help victims. The House has passed similar legislation and the White House has voiced support.

"We have not fallen deaf to the cries of those who actually need our help, the victims of human trafficking," said Sen. John Cornyn, R-Texas, the lead GOP sponsor. "This legislation will be instrumental in helping victims of sexual abuse and trafficking recover from a life in bondage."

The unanimous outcome put a bipartisan punctuation mark on legislation that started out with wide support from both parties, but veered into a partisan cul-de-sac last month when Democrats said they'd noticed language that could expand federal prohibitions on abortion funding. How or why Democrats had failed to see the provision in the first place became a topic of frosty dispute on Capitol Hill, with Republicans pointing out that the bill had unanimously passed committee, and one Democratic senator's office acknowledging that an aide had in fact known of the abortion language.

At the same time, Attorney General-designate Loretta Lynch languished despite commanding enough votes to be confirmed, because Republican leaders made the decision, never fully explained, to delay her confirmation vote until the trafficking bill was completed. Now that it is, Lynch will get a vote Thursday to replace Eric Holder and become the nation's first black female attorney general.

The partisan gridlock on the trafficking bill and Lynch made no one look good, and with all sides eager for a resolution Cornyn worked with Sens. Patty Murray, D-Wash., and Democratic Leader Harry Reid of Nevada to arrive at a compromise, which they announced Tuesday. It addresses Democratic concerns about expanding prohibitions on spending federal funds for abortions, by splitting the new victims' fund into two pieces.

One part of the fund would be made up of fines paid by sex traffickers, and it could not go for health services, rendering the abortion restrictions moot. The other part of the fund, which could go for medical services, builds on $5 million already appropriated by Congress for Community Health Centers, which are already subject to abortion spending prohibitions. The compromise allowed both sides to claim a win since Republicans ensured any money for health services could not go for abortions, while Democrats could say that they had prevented prohibitions on spending federal money for abortions from being expanded to a new source of money.

"An effort to fight back against human trafficking in our country is, without question, no place for gridlock and dysfunction," Murray said. "It certainly shouldn't have taken this long but I'm pleased that we were able to work together, find common ground and reach an agreement."

With the bill finally greased for passage following announcement of the abortion compromise, Republican leaders staved off one final partisan controversy by persuading conservatives in the caucus to hold back on a handful of immigration-related amendments they wanted to offer. Sen. Jeff Sessions, R-Ala., said he was urged to pull back an amendment that would have allowed for punishing people for immigrating illegally with their kids or other family members.

"I yielded to higher authorities against my better judgment. ... We ended up with no immigration amendments," Sessions said. "They wanted another bipartisan accomplishment and it wouldn't have achieved it."

The amendments that did get attached to the bill passed with little controversy, though one, by Sen. Mark Kirk, R-Ill., drew concerns from at least one advocacy group. The measure would make it illegal for websites or social media sites to "knowingly" sell advertisements for sex services involving minors. A pro-privacy group, the Center for Democracy and Technology, said the measure was so vaguely written that it potentially makes every U.S. company that hosts web content subject to criminal prosecution.

Announced presidential candidate Sen. Ted Cruz, R-Texas, missed the vote.