The firing triggered panic among the people in Sadulpur town.
The incident happened when an undertrial, Ajay Jaitpura, arrived for a court hearing at 1 pm.
Three-four unidentified men opened fire on Jaitpura, leaving him, advocate Ratan Lala and another person seriously injured, police said.
The assailants then fired in the air and fled the spot in an SUV parked outside the court complex.
The injured persons were referred to Hisar in Haryana for treatment in a critical condition. A search is on to nab the assailants, SP Churu Rahul Barhat said.