All three attackers were also killed, said Samim Ekhpelwak, a spokesman for the governor of Kandahar province.
The Taliban took responsibility for the attack, saying the gunmen carried machine guns and were targeting foreign forces, Taliban spokesman Qair Yousful Ahmadi said in a statement.
Kandahar, the second-largest city in Afghanistan, is about 300 miles (480 kilometers) southwest of Kabul, the country's capital.