Britain and the European Union must build a close security partnership after Brexit to foil Islamic State militant attacks and counter Russia's malign attempts to subvert Western democracies, the head of Britain's domestic spy agency said.

Britain, as Europe's preeminent intelligence power, is seeking a new security pact with the bloc to ensure it gets continued access to secrets from major EU countries as it seeks to clinch a broader Brexit deal.

In the first public speech outside Britain by a serving head of MI5, Andrew Parker will tell an event in Berlin hosted by Germany's BfV domestic intelligence service that Islamic State militants are plotting "devastating and more complex attacks."