Washington: US consumers will be allowed to unlock their cellphones and move them to a new carrier, under a law adopted on Friday to fix a perceived glitch in copyright law.

The House of Representatives approved the measure unanimously one week after Senate passage of the bill, sending the legislation to President Barack Obama.

Under the Unlocking Consumer Choice and Wireless Competition Act, users will be able to unlock handsets and switch carriers without fear of prosecution, provided any contract terms from the original sale are honored.

The law became necessary after the Librarian of Congress ruled that those who circumvent the software locking a mobile phone to a single carrier are violating the Digital Millennium Copyright Act, enacted to thwart piracy.

The ruling generated a flurry of protests from civil liberties and digital rights activists.

Unlocking has been possible through requests to carriers, but those who did it themselves - a practice sometimes called “jailbreaking” - would be subject to prosecution.

Over 100,000 people signed an online petition last year asking the White House to support a revision of the law.

Senator Patrick Leahy, one of the sponsors of the bipartisan bill said it “puts consumers first, promotes competition in the wireless phone marketplace, and encourages continued use of existing devices.”