The House of Representatives on Friday approved a bill that will make it legal for consumers to unlock their phones and take them to another carrier. 

The measure was already passed by the Senate earlier this month, and President Obama applauded the bill, saying he would sign it into law immediately. 

In a statement, Obama said the White House had laid out steps that the FCC, industry, and Congress should take to ensure copyright law does not undermine wireless competition, and worked with wireless carriers to reach a voluntary agreement that helps restore consumers' rights to unlock their phones. 

"The bill Congress passed today is another step toward giving ordinary Americans more flexibility and choice, so that they can find a cell phone carrier that meets their needs and their budget," the President said. "I commend Chairmen Leahy and Goodlatte, and Ranking Members Grassley and Conyers for their leadership on this important consumer issue and look forward to signing this bill into law."

The move comes in response to a January 2013 ruling by the U.S. Copyright Office of the Library of Congress to make unlocking a cell phone illegal in some circumstances. The move was made to help stem large-scale phone trafficking but left a chance that consumers could face penalties for unlocking their devices, ranging from fines of $2,500 to five years in prison.

That rulemaking was not popular. More than 100,000 people signed a petition imploring the White House to make unlocking legal again, and the FCC agreed to investigate the matter.

The Unlocking Consumer Choice and Wireless Competition Act make unlocking legal until the next year when the Library of Congress meets for another session of rulemaking. The bill includes language that directs the Library of Congress to consider in its rulemaking how to deal with other devices like tablets and cellular-connected laptops.