WASHINGTON — The U.S. House of Representatives passed legislation Wednesday that links student loan interest rates to the markets, sending the bill to President Obama in time to ensure lower rates for millions of college students this fall.

The bill was crafted in the Senate by a small, bipartisan group of lawmakers that included Maine Sen. Angus King, an independent who caucuses with the Democrats. The measure removes Congress from the process of setting interest rates for federally backed student loans, instead basing those rates on the 10-year Treasury notes plus an additional percentage to cover administrative costs.

Under the bill, all undergraduates taking out Stafford loans this fall will pay 3.9 percent – down from the 6.8 percent rate that kicked in July 1 – while graduate students will pay 5.4 percent and parents will pay 6.4 percent. Rates will be locked in for the life of the loan; however, rates for new loans will likely vary year to year as the Treasury note rates rise and fall. Undergraduate loans will be capped at 8.25 percent.

For King, student loans were the first major policy issue where he played a leadership role in his six-month Senate career. The basic bill was negotiated by King, Democratic Sens. Joe Manchin of West Virginia and Tom Carper of Delaware, and Republican Sens. Lamar Alexander of Tennessee, Richard Burr of North Carolina and Tom Coburn of Oklahoma.

“In a divided government, the only way to pass meaningful legislation and accomplish the business of the nation is to find common ground and compromise,” King said in a statement shortly after the House voted 392-31 to pass the bill. “That’s just what we did in the Senate and I believe that effort helped to lay the groundwork for the bill’s acceptance in the House. As the legislation heads to the president for his signature, Congress must continue to work in a bipartisan manner to address the serious issues confronting the country.”

Both of Maine’s House members – Democrats Chellie Pingree and Mike Michaud – supported the bill, as did Republican Sen. Susan Collins during the Senate vote.

Michaud said the bill was “an all too rare example of Congress coming together to compromise and get something done” and applauded King for his role in the negotiations.

Opponents of the bill – mostly from the Democratic side of the aisle – predicted that the legislation would save students money now but could end up costing them more several years down the road when Treasury rates rise. They also said the bill does nothing to address the larger issue of rapidly rising higher education costs.

The White House was involved in the latter-stage negotiations of the bill, especially as King, Manchin and Carper were trying to win over skeptical Democrats. Obama is expected to sign the bill.