Magistrate Latha, given additional charge of the Nagapattinam Judicial Magistrate court, was returning to Vedaranyam last night in a car, when some persons intercepted it and attacked her and the driver.
Both the magistrate and the car driver have been admitted to a private hospital.
The motive behind the attack was not immediately clear, they said.
Meanwhile, about 450 members of the Kumbakonam Bar association boycotted courts today and staged a demonstration here in protest against the attack.
They demanded swift action against the culprits and adequate protection to judges.