BERLIN — European lawmakers on Thursday agreed on new protections for Internet users, striking a compromise between national governments seeking to impose tough anti-piracy laws and consumer organizations that wanted to enshrine Internet access as an unassailable right.

The agreement removes the last hurdle to passage of sweeping changes to European telecommunications law, which had been held hostage for six months by the standoff over Internet access.

After five hours of closed-door talks in Brussels, negotiators for the European Parliament, the European Commission and the Council of Ministers, which represents national governments, reached the agreement shortly before 1 a.m. Under the compromise, any decision to sever Internet access, an approach championed by several E.U. countries seeking to clamp down on digital copying of music and movies, must be subject to a legal review.

Backers hailed the deal, saying it would legally underpin the right to Internet access in Europe while stopping short of facilitating widespread criminal piracy.