WASHINGTON (Reuters) - The U.S. House of Representatives on Friday cleared the way for quick confirmation of James Mattis to serve as President-elect Donald Trump’s secretary of defense, backing a waiver that will allow him to serve less than seven years after retiring from active duty as a Marine General in 2013.

Retired U.S. Marine Corps General James Mattis testifies before a Senate Armed Services Committee hearing on his nomination to serve as defense secretary in Washington, U.S. January 12, 2017. REUTERS/Jonathan Ernst

The House voted 268 to 151, largely along party lines, for a one-time waiver of a provision of a law on civilian control of the U.S. military that requires a seven-year wait after retirement before active-duty military can lead the Department of Defense.

The waiver, which must still be signed by the president to become law, clears the way for Mattis to lead the Pentagon if he is confirmed, as expected, by the Senate.

The Senate passed the waiver on Thursday by 81-17.

A White House spokesman said on Friday that President Barack Obama would sign the measure if it came to his desk, rather than make it wait for Trump to be sworn in as president on Jan. 20.

Most Democrats voted against the waiver, while Republicans supported it. One House member voted present.

Mattis had been scheduled to testify before the House Armed Services Committee this week, but Trump’s transition team canceled his appearance.

Democrats said they supported Mattis, but the cancellation set a dangerous precedent for Trump to sidestep Congress. Normally, lawmakers are able to question legislation in committee hearings before bills are brought up for votes in the full House.

“Before this president is even in office, at the very first opportunity, he is choosing to completely ignore us for no reason,” said Representative Adam Smith, the top Democrat on the armed services panel.

Democrats also said they worried that the waiver does not exempt Mattis from the Uniform Code of Military Justice, to which retired officers are subject for life. In theory, he could be court-martialed by Trump, as the commander in chief.

Representative Mac Thornberry, the Republican chairman of the committee, said he was also unhappy that the hearing had been canceled, but said the House had a responsibility to the country and the military to ensure that a Secretary of Defense is in place as soon as Trump becomes president.