Justices on Brazil's highest court have voted to restrict a legal protection afforded federal lawmakers that critics say has resulted in impunity.

The protection known as "privileged standing" allows tens of thousands of politicians to have cases against them tried at higher courts than a normal citizen would. It results in cases frequently shifting venues as defendants switch jobs. Cases against federal lawmakers are tried by Brazil's top court and they often move slowly on its overloaded docket.

The Supreme Federal Tribunal decided Thursday that the protection only applies to crimes allegedly committed while the lawmaker is in office and that are related to the exercise of that office.

Experts say that could result in much swifter justice for senators and deputies.