The men fired back and requested air support and reinforcements.
Germany has about 3,700 troops serving with the Nato-led International Security Assistance Force (Isaf), stationed in the north of the country.
There has been a rise in violence across Afghanistan since campaigning for the country's presidential election officially began last week.
The poll is due to be held on August 20.
Forty-one candidates are standing for the five-year term, including Hamid Karzai, the incumbent president.