Early Tuesday, forest officials near the town of Tirupati spotted hundreds of smugglers cutting trees for red sandalwood, said Deputy Inspector General Kantha Rao, a law enforcement official.
The forest officials, who were unarmed, called for police, including an anti-smuggling task force, said Rao, who works for the task force.
"We saw several trees chopped down," he said. "These guys came prepared and were heavily armed."
Rao said the ensuing gunbattle lasted more than three hours and more than 20 smugglers were shot. Many of them came from the neighboring state of Tamil Nadu, he said.
The India Express newspaper published a photo on its website showing a scrubby forest with three bodies lying on the ground.
Rao said sandalwood smuggling is common in the area.
Local media are reporting that politicians from Tamil Nadu have lodged a protest against the Andhra Pradesh government, saying the alleged smugglers were murdered in cold blood. So far, there has been no comment from the Andhra Pradesh government.