BERLIN—Germany’s top prosecutor Tuesday said two soldiers and an accomplice plotted high-profile assassinations that would be blamed on a migrant, escalating a controversy over right-wing extremism in the military that is weighing on the German government.

Police detained a 27-year-old soldier identified as Maximilian T. on suspicion of conspiring to kill high-ranking politicians and other prominent individuals whom he and his two alleged accomplices saw as proponents of a misguided refugee policy, the prosecutor said.

...