From 1872 to 1874 , Kuropatkin studied at the Nicholas General Staff Academy , after which he was dispatched as a military attaché to Berlin and Paris , completing his military studies , and with the French troops in Algiers , accompanying a French expedition to Sahara .