The general election was supposed to be dominated by Brexit, but the terror attacks in Manchester and London have forced security to the top of the agenda. Where do the major parties stand and what are their key differences of opinion?
What have the party leaders said?
Jeremy Corbyn has spent the election campaign fighting accusations he is soft on terrorism, with opponents repeatedly bringing up his past dealings with the Irish Republican movement in the 1980s as evidence that he is not the right man to respond to the current challenge.
Defence Secretary Michael Fallon called the Labour leader “a very serious risk” to Britain’s national security.
Theresa May has hinted at a wide-ranging review of current measures. “Enough is enough,” she said on Sunday in response to the London Bridge attack.
But Mr Corbyn accuses the Conservatives of trying to “protect the public on the cheap”. He says intervention in places such as Iraq and Libya has increased the terror threat to the UK.
Tim Farron, the Liberal Democrat leader, says society must come together to tackle terrorism. He rounded on Mr Corbyn for using terror attacks to score political points, but SNP leader Nicola Sturgeon has jumped to his defence.
UKIP’s Paul Nuttall pledges to “cut out the cancer of radical Islam” and accuses the other parties of being too cowardly to tackle terrorism effectively. Unlike other parties, UKIP refused to suspend national campaigning in the wake of the London Bridge attack, saying it was exactly what the terrorists would have wanted.
Caroline Lucas, of the Green Party, stresses the need to take a more constructive approach to building links with the Muslim community.
Do we need more police officers?
The Conservatives have been criticised for reducing police numbers by an estimated 20,000 while in office. Both Labour and the Liberal Democrats argue that has made it harder to gather intelligence and to counter the terrorist threat.
Culture Secretary Karen Bradley accepts police numbers have fallen, but said: “It’s not just about numbers, it’s about powers.”
Theresa May said the Conservatives had protected counter-terrorist policing and budgets, and provided funding for an increase in the number of armed police officers since 2015.
The Tories would introduce legislation to make changes in police practices if “stop and search does not become more targeted and stop to arrest ratios do not improve”.
Labour pledges to recruit 10,000 more police officers to work community beats.
Mr Corbyn, who has previously questioned the wisdom of a shoot-to-kill policy, has backed the police to use “whatever force is necessary” to save lives.
The Liberal Democrats would set aside £300m for community policing in England and Wales and require all front-line officers to wear body cameras on duty.
UKIP promises 20,000 extra police officers.
Plaid Cmyru pledges to secure an extra £25m for Welsh police forces.
Do the security services need more resources?
Home Secretary Amber Rudd said the government was already recruiting 1,900 extra people for the intelligence agency MI5 and had committed to raising the security budget from £11bn in 2015 to £15bn in 2020.
The Conservatives would create a national infrastructure police force, bringing together the Civil Nuclear Constabulary, the Ministry of Defence Police and the British Transport Police to improve the protection of critical infrastructure such as nuclear sites, railways and the strategic road network.
Labour promises 1,000 more security and intelligence agency staff and 500 more border guards. It commits to providing the security agencies with necessary resources to keep the country safe, but says use of investigatory powers must be “proportionate and necessary” and subject to judicial oversight.
The Liberal Democrats pledge to continue cross-border co-operation between security forces across Europe.
UKIP would recruit 4,000 extra border guards.
How best to improve counter-terrorism?
The Conservatives plan to set up a new commission – with “proper teeth and a clear remit” – to identify and expose examples of extremism.
New criminal offences to combat extremism will also be considered.
Mrs May has defended the Prevent deradicalisation strategy as an effective way to thwart terrorism. The scheme is likely to be expanded and strengthened if she returns to power.
Labour says it will review Prevent, raising concerns it has alienated the very minority communities on whose support it depends.
The Liberal Democrats call it a flawed strategy, and would scrap it in favour of a scheme that “prioritises community engagement and supports communities in developing their own approach to tackling the dangers of violent extremism”.
The party is also committed to “rolling back state surveillance powers” such as the “indiscriminate” bulk collection of communications data.
The Green Party would also scrap Prevent. Co-leader Ms Lucas called the scheme “toxic”, saying Muslim communities feel “attacked”.
UKIP has called for a review of the funding of mosques in Britain.
SNP leader Ms Sturgeon says it makes sense to review counter-terror arrangements, but warns no community should be made a scapegoat for the actions of a “mindless minority”. She criticised the Westminster government’s failure to publish a report into the funding of extremist ideology in the UK.
What are the plans on immigration?
The Conservatives have pledged to cut annual net migration to below 100,000.
Labour says this target has not come close to being met since 2010. While it accepts that freedom of movement will end when the UK leaves the EU, it has refused to put any figures on what the figure should be. It pledges not to “scapegoat migrants, discriminate between people of different race or creed or blame them for economic failures”.
The Liberal Democrats stress that immigration is good for the UK, however its manifesto promises strict control of borders.
UKIP would aim to reduce net migration to zero within five years and ban anybody who left the UK to fight for so-called Islamic State from returning to the country.
The SNP manifesto “encourages the best and brightest from Europe, and around the world, to make Scotland their home”. It promises to “stand firm against the demonisation of migrants”.
The party will press for immigration powers to be devolved to the Scottish Parliament, so that Scotland can offer different arrangements from the rest of the UK to attract European nationals.
Is online security a big deal?
Mrs May has urged world leaders to do more to combat online extremism, saying the fight against so-called Islamic State is “moving from the battlefield to the internet”.
She wants companies to develop tools which automatically identify and remove harmful material based on what it contains and who posted it. The Conservatives have also called on technology firms to allow access to information if required to fight radicalisation.
Labour says the threat posed by online radicalism would be assessed as a part of a strategic defence and security review if the party wins the election. It would introduce a cyber-security charter for companies working with the Ministry of Defence.
The Liberal Democrats are opposed to any blanket crackdown on the use of encryption to hide sensitive information, which they see as a threat to the rights of the individual. Tim Farron said: “If we turn the internet into a tool for censorship and surveillance, the terrorists will have won.”