At the outbreak of the 1870–71 Franco-Prussian War, Peter joined the French Foreign Legion under the pseudonym Petar Kara, together with relative Nikola Nikolajević. During his service, Peter held the rank of either lieutenant or second lieutenant, depending on the source, and fought with the 1st Foreign Regiment. He participated in the Second Battle of Orléans on 3–4 December 1870, as well as the Battle of Villersexel on 9 January 1871. He was awarded the Legion of Honour for his conduct during the two battles, but was captured by the Prussians shortly thereafter. He managed to escape captivity and returned to the front. Peter was involved in the Paris Commune in the spring of 1871, together with close friend and relative Vladimir Ljotić, though the exact nature of his involvement remains unknown.