The German government has removed the country's domestic spy chief who faced accusations of harbouring far-right sympathies - but transferred him to an essentially more senior role amid efforts to end an impasse over immigration.