After weeks of infighting, the Republican-controlled Congress passed major trade legislation Wednesday that was long sought by President Barack Obama but vehemently opposed by most lawmakers in the Democratic Party.

The measure, designed to speed up approval of a proposed free trade agreement, will now go to the White House for the president’s signature. The bill's final passage comes less than two weeks after it was temporarily derailed in the House by an uprising of Democratic lawmakers who argued it would cost U.S. jobs.

The measure will allow Obama to negotiate global trade deals that Congress could approve or reject but not change. The administration was seeking this so-called "fast track" as it worked to complete a round of trade negotiations involved 12 nations along both sides of the Pacific Ocean, including Japan.

The 12 participating nations in the current Pacific-based talks account for 40 percent of the world's economy, and include Japan, Malaysia, Australia, Canada and Mexico. China is not a member, and Obama says a ratified Pacific-rim pact will reassert the United States' muscular role in international standards for commerce, treatment of workers and the environment.

But labor unions, environmental groups and other traditional allies of the president have firmly opposed the proposed Trans-Pacific Partnership (TPP), as well as the administration's efforts to win fast-track authority.

These groups have denounced the secrecy surrounding TPP negotiations, as well as some leaked provisions suggesting that corporations in member states would be able to challenge regulations in other countries through an international court. Organized labor has argued that the trade deal will cost jobs and undermine labor standards in the U.S.; green groups believe it will eat away at environmental regulations.

Through aggressive lobbying, TPP's opponents were able to temporarily stymie approval of fast-track authority. Influential Congressional Democrats, including House Minority Leader Nancy Pelosi, bucked the president's wishes and opposed the fast-track legislation.

The White House tried to cast a soft light on the division.

“We have Republican majorities in Congress working closely with Democratic minorities in Congress to build bipartisan support for legislation that then arrives on the desk of a Democratic president,” said White House spokesman Josh Earnest. That's how policy should be made “in an era of divided government,” he told reporters.

Republican leaders, with White House support, restructured the legislative package and passed its key elements through the House with big GOP margins, plus modest Democratic support. The bill then went to the Senate, where it drew the support of 47 Republicans and 13 Democrats. Five Republicans, 31 Democrats, and both of the Senate's two independents were opposed.

Sen. Orrin Hatch, R-Utah, and chairman of the Senate Finance Committee, hailed the measure as “the most important bill that will pass the Senate this year,” and one that will prove to be an aid to the economy.

Frequent labor ally Sen. Sherrod Brown, D-Ohio, countered shortly before the vote that it would be nothing of the sort. He said it would lead to “corporate handouts, worker sellouts,” as he said had been the case with the North American Free Trade Agreement and other deals across the past two decades.

A companion bill, to renew an expiring program of federal aid for workers disadvantaged by imports, passed by voice vote less than an hour after Wednesday's vote on fast-track. Final approval of that bill in the House is expected on Thursday.

Al Jazeera and Associated Press