Why did the first battle of the marne occur?

After the invading German forces had moved to within 30 mi (50 km) of Paris at the Marne river, Marshal Joseph-Jacques-C├ęsaire Joffre counterattacked and halted the German advance.