 Serbian politician Ilija Garašanin recruited Piroćanac into the Foreign Ministry of Serbia.After Serbia and Montenegro concluded an alliance in 1866, brokered by Prince Mihailo Obrenović and Prince Nikola I Petrović-Njegoš so that the two Serb principalities could jointly fight the Ottoman Empire, Piroćanac spent several months in Cetinje, as a political representative of Serbia, serving, in addition, as a secretary to Prince Nikola.He began a career as a judge in 1868 and was posted at the Court of Cassation in 1872.