In the simulation, "terrorists" drove a truck into a building in Edinburgh, with dozens of volunteers posing as casualties.
A joint counter-terrorism exercise to enhance cross-border co-operation in the fight against terror has been launched by police forces in Scotland and England.
A mock attack has been staged at the Royal Bank Headquarters in Edinburgh, in which "terrorists" drove a truck into a building.
They then used knives and automatic weapons to "inflict" mass casualties.
The three-day training exercise, codenamed Operation Border Reiver, is designed to test the response of the police and emergency services.
It will last until 5 October, extending to other sites and properties in Scotland and the North East of England.
About 100 volunteers, posing as casualties, lay sprawled around the grounds of RBS near Edinburgh Airport following the mock attack. They were treated by ambulance crews carrying shields and wearing body armour.
The scenario involved a truck being driven into a building (represented by a tent) and the "terrorists" then shooting and stabbing people in the vicinity.
As armed police officers arrived on the scene, the "terrorists" retreated inside a building containing members of the public.
Groups of firearms officers laid siege to the building and the noise of gunfire and explosions rang out as the situation developed.
Police Scotland's Assistant Chief Constable, Bernard Higgins, told Sky News: "The scenario is based on recent tragic events. We have been planning for this for about 10, 11 months now.
"As recent events have unfolded, we've changed the tactical parameters of what we're going to do. It is based on a large-scale terrorist incident where there will be a significant number of casualties.
"Exercises in the past have been based on what had happened in the past. This is probably the most current exercise in terms of the threat that we believe we will face in the UK.
"I think many years ago, the terrorist threat was pretty sophisticated. As people have seen, what we now face is pretty much low sophistication, person-borne attacks using vehicle or bladed weapons but the impact is significant. That's the broad scenario that we are testing."
Home Secretary Amber Rudd played a role in the exercise, taking time out from the Conservative Party conference to chair a COBR meeting involving ministers from the UK and Scottish governments.
She said: "The events of this year have shown why it is vital that the emergency services, Government and agencies prepare and rehearse our response to potential terrorist attacks.
"The professionalism with which front line services dealt with the atrocities in London and Manchester is in part due to the planning and practice that goes into exercises like this."