Some politicians have accused the head of Germany's intelligence service of eroding trust in the government at a time when the country is bitterly divided over migration.