The boy was rescued two days after a four-member gang, led by criminal mastermind Divyateja, kidnapped him in Bengaluru and demanded a ransom of Rs 35 lakh, they said.
Divyateja was injured in shooting and later arrested along with three others.
Acting on a complaint from the boy's father, police launched a manhunt and tracked one of the gang members, who revealed that Divyateja was driving with the child in his car towards Kengeri, Bengaluru.
Immediately, police chased down the vehicle at a secluded place and intercepted it. That's when Divyateja pulled out a machete and tried to attack them, police said.
"In self-defense, we opened two rounds of fire. One of the bullets hit his right leg and he collapsed on the ground," the police said in a press release.
The accused was moved to Victoria Hospital, where he is undergoing treatment.