There is a "real" threat of terrorists crossing from Northern Ireland to Scotland by ferry, one of the UK's leading terrorism experts has said.
David Anderson QC gave the warning in a report written before he stood down as the UK independent terrorism reviewer.
Officers at Scottish ports told him they had "incomplete and unreliable" information from the ferry companies.
Police Scotland this month launched a campaign urging the public to help defeat terrorism.
Mr Anderson said: "The threat of terrorists crossing from Northern Ireland to Scotland is a real and substantiated one.
"The Canary Wharf truck bomb of 1996, manufactured by the IRA in South Armagh, killed two people, injured more than 100 and caused £150m worth of damage.
"It was transported from Larne to Stranraer on a Stena Lines ferry, then driven to London."
Mr Anderson stood down as the terrorism reviewer at the start of March.
His report said passenger lists for ferries connecting Belfast and Larne in Co Antrim to the Scottish west coast were incomplete and unreliable.
He warned port security had been impaired by shortcomings.
Mr Anderson added: "On my visits in 2015/16 to the seaports of Kent and to Cairnryan and Loch Ryan in the south-west of Scotland, the common and strongly expressed refrain from ports officers on the ground was that they could do their jobs more effectively if they had better advance information about passengers arriving (and departing) by sea.
"In the absence of such information, it is impossible to target stops as precisely as it is, for example, at airports where advance passenger information is widely available."
Police Scotland has defended its efforts in ensuring security at sea ports.
A statement from the force said: "While there is a distinction between the type of passenger information available at a ferry port compared to an international airport, officers from Police Scotland's Border Policing Command work closely with operators at the respective ferry ports to ensure this is a safe environment for passengers who travel as well as the safety and security of communities elsewhere in the UK."
Mr Anderson also said the border between Northern Ireland and the Republic of Ireland was being used by extremists based in the south.
The border with the Republic and freedom of movement between Britain and Ireland is coming under fresh scrutiny as the Prime Minister prepares to launch Brexit negotiations.