NEW DELHI -- Top Bollywood star Salman Khan was acquitted by a court on Wednesday on a charge of using unlicensed weapons while hunting for rare blackbucks in a western India wildlife preserve 18 years ago.

Khan, 51, was present as Chief Judicial Magistrate Dalpat Singh Rajpurohit announced his acquittal in Jodhpur, a city in Rajasthan state.

His attorney, Hastimal Saraswat, said the magistrate dismissed the charge against Khan for lack of evidence. If convicted, he would have faced up to seven years in prison.

The prosecution argued that the license for a revolver and a rifle allegedly used by Khan had expired in 1998.

As Khan's fans cheered his acquittal, he tweeted: "Thank you for all the support and good wishes."

The Indian court system is notoriously slow, and it often takes years and even decades for cases to go to trial.

Apart from the illegal weapons case, police filed three poaching cases against Khan during the shooting of one of his films in Jodhpur in 1998.

He was convicted by a lower court and sentenced to jail terms of one and five years in two cases. But the actor challenged the verdict in a higher court, which said there was no evidence to suggest that the pellets recovered from the animals were fired from Khan's gun. He is still facing trial in a third case of alleged poaching of two rare blackbucks.

Khan, who has starred in more than 90 Hindi-language films, has had other brushes with the law.

In 2014, the Mumbai High Court acquitted the actor in a drunken-driving, hit-and-run case from more than a decade ago.

The judges found that prosecutors had failed to prove charges of culpable homicide, in which they accused Khan of driving while intoxicated in 2002 and running over five men sleeping on a sidewalk in Mumbai, killing one of them.

The government of Maharashtra state, of which Mumbai is the capital, has challenged his acquittal in the Supreme Court.