The Scottish Parliament is to spend £6.5m on a new security facility to screen people before they enter the Holyrood building.
Presiding officer Tricia Marwick told MSPs that the move followed "clear and consistent security and legal advice" based on current threat levels.
Security advisers are concerned that the current location of the security scanners at the main entrance puts them too close to the debating chamber and public areas where large numbers of people, including school groups, tend to gather.
A paper by the Scottish Parliamentary Corporate Body (SPCB) warned officials they could be liable under corporate manslaughter legislation if Holyrood was attacked and it was shown that they had failed to take adequate steps to protect the public.
The SPCB said it had a duty of care to the 400,000 visitors and 1,000 passholders who use the building each year.
Construction on the facility, which is being moved outside the main building, is due to begin on October and conclude next summer.
The cost will be funded by postponing other projects, including an upgrade to Holyrood's IT network and the replacement of broadcast equipment.
The £6.48m bill, which includes VAT, is being spread across two financial years to absorb the cost within the Parliament's existing budget.
The tendering process was organised on the basis of a fixed design with a fixed cost to prevent cost increases after the contract was awarded.
A spokesman for the Parliament said there was no imminent or specific threat to the Holyrood building, but the current facilities represented a "medium to high" threat to security.
In her letter to MSPs, Ms Marwick said: "Since the outset of this process which began in 2007 with a security review, the SPCB has followed the same prudent, staged approach to taking decisions on this important issue.
"Throughout that period, there has been a singularly clear message from our security advisers - namely that in light of current threats, it is highly advisable to construct an external security facility.
Let me stress that this is not a decision the SPCB has taken lightly, especially in the current economic climate, but the legal advice to us is equally clear. We have a duty of care to all MSPs, staff, contractors and to the 400,000 members of the public who come through our doors each year, and in law we must take all steps 'reasonably practicable' to safeguard their wellbeing.
"It is incumbent upon us to take the right decision on behalf of those whose safety is our responsibility."
- Security extension proposed for Scottish Parliament
- Millions spent on Holyrood 'improvements'
- Holyrood to cut running costs by £9.5m