Kabul, Afghanistan (CNN) -- German forces with the NATO-led command killed at least five Afghan soldiers in northern Afghanistan in a friendly fire incident, the German military said Saturday.

Friday night's killings in Kunduz province came hours after three German troops died and eight others were wounded in fighting with the Taliban in the same area, the military said.

The German army regards that fight as one of the "most grave and costly" incidents for the military since World War II, a military spokesman said.

The German military said five Afghan soldiers were killed Friday night, but the Afghan Defense Ministry said six died in the flare-up.

The German troops were on their way to replace other soldiers when two civilian vehicles moved toward them and didn't stop, the German military said.

As a result, an artillery tank opened fire on the vehicles, the ministry said. After the shooting, the troops learned the vehicles were carrying Afghan soldiers.

Afghanistan's Defense Ministry said Afghan soldiers were carrying food to troops in the Khakani village of Chardara district of Kunduz province when German soldiers shot them by mistake.

"This loss of life during difficult operations is tragic, and we share condolences with all those who lost loved ones yesterday, said Brig. Gen. Eric Tremblay, NATO's International Security Assistance Force spokesman.

"We work extremely hard to coordinate and synchronize our operations, and incidents such as this hurt these efforts. We deeply regret the loss of lives from our Afghan partners."

The NATO-led command and Afghan Defense Ministry were investigating.

Germany has 4,335 soldiers serving in Afghanistan.

CNN's Ben Brumfield and journalist Matiullah Mati contributed to this report.