NEW DELHI — An Indian court convicted the Bollywood star Salman Khan on Thursday in two cases of killing rare antelopes, settling — for now — a bitter legal battle that has stretched over nearly 20 years.

In pronouncing the verdict, Dev Kumar Khatri, the chief magistrate of the court in Rajasthan State, called Mr. Khan a “habitual offender” against India’s wildlife protection laws. Mr. Khatri sentenced Mr. Khan to five years in prison, and also directed him to pay a small fine.

Four other actors accused of being involved in killing the antelopes, called blackbucks and protected under the law, were acquitted for lack of evidence. Mr. Khan is expected to spend the night in jail in the city of Jodhpur. His lawyers said they would appeal the decision and apply for bail.

The case stretches back to 1998, when prosecutors said Mr. Khan, one of India’s biggest stars, went hunting with several other actors outside a forest reserve near Jodhpur while shooting the film “Hum Saath Saath Hain.”