Three people, including the driver and a conductor, have died after a passenger train derailed in Aberdeenshire.
The third victim was a passenger, ScotRail has confirmed.
It is thought the train hit a landslide after heavy rain and thunderstorms which caused flooding and travel disruption across Scotland.
A major incident was declared and about 30 emergency service vehicles were called to the scene.
It involved the 06:38 ScotRail service from Aberdeen to Glasgow Queen Street.
Six people have been taken to hospital but their injuries are not believed to be serious.
British Transport Police said the families of the driver and the conductor had been informed and were being supported by specially-trained liaison officers.
Ch Supt Eddie Wylie said it was believed that all passengers had been accounted for.
He added: "Once the area has been made safe then a full and thorough search will be conducted, which is likely to take some time.
"I know many people will understandably have questions and we will be working closely alongside the Rail Accident Investigation Branch and the Office of Rail and Road to establish the full circumstances of how the train came to derail."
The RMT union said that confirmation of the three deaths, including one of its conductor members, was "the most dreadful news".
Senior assistant general secretary Mick Lynch added the union's thoughts "were with the families, colleagues and friends of those who have lost their lives in this tragedy."
Early indications are that the heavy rain could have been the main factor in causing today's crash in Aberdeenshire.
One rail industry source says the 06:38 service from Aberdeen to Glasgow was initially halted because of flooding on the line.
The driver apparently contacted control to ask permission to switch tracks.
It's believed the train reversed and switched to clearer tracks and then continued on its route to Glasgow.
Then it is thought the train hit a landslide and derailed.
However, this initial, unconfirmed version of events should now be closely examined by the UK's Rail Accident Investigation Branch.
Its job is to establish all the facts.
The train's computer systems should show key indicators like the speed it was travelling at when it left the track.
In recent years incidents like this on the UK's railways have become incredibly rare. The last major derailment was in 2007 in Cumbria.
The Queen issued a message of condolence following the crash, saying "it was with great sadness that I heard of the train derailment".
Her Majesty said the entire Royal Family "join me in sending our thoughts and prayers to the families of those who have died and those who have been injured".
First Minister Nicola Sturgeon expressed her "deepest condolences" to the loved ones of those who lost their lives in the "tragic incident".
"My thoughts remain with everyone affected," she said.
Prime Minister Boris Johnson told the BBC the crash was especially shocking because "these accidents on the railways are thankfully so rare".
"Our thoughts are very much with those who have lost their lives and their families and, of course, those that have been injured in the derailment," he added.
"Clearly the most important thing now is that the British Transport Police, who are in charge of the investigation, find out exactly what happened and we all work together to make sure nothing like this ever happens again."
The train which derailed was made up of two locomotives - at the front and back - and four carriages.
Network Rail has reviewed CCTV footage from the stations at which the service stopped and it's believed there were nine people, including crew, on the train.
British Transport Police said its officers had been called to the scene at about 09:43.
A few minutes later, Network Rail tweeted that there had been reports of a landslip at Carmont and that services between Dundee and Aberdeen had been halted.
The chief executive of Network Rail, Andrew Haines, is cutting short his family holiday in Italy to fly back to the UK.
Transport Secretary Grant Shapps said he would visit the site on Thursday "to try to understand the situation first hand and offer every possible assistance".
NHS Grampian confirmed it was on a "major incident footing", and ScotRail said it was assisting the emergency services.
The RMT union's Mick Lynch said: "The facts behind this incident will need to be established in due course, but at this stage we are focussed on support and assistance and our thoughts are with all those impacted by this tragedy."
Kevin Lindsay, Scotland organiser for the Aslef train drivers union, said: "Our thoughts tonight are with all those who died, and who were injured, in the tragic accident.
"While it is too early to speculate about the causes of the crash, it would seem that the appalling weather conditions in the area - the torrential rain - resulted in a landslip which, in turn, caused the train to derail."
He added that the train had caught fire after rolling down a steep embankment.
Aberdeenshire Provost and Mearns councillor Bill Howatson said: "Our thoughts and prayers are with everybody involved. This is a harrowing time for all concerned."
Meanwhile four firefighters were injured while responding the derailment.
BBC Scotland understands they suffered minor injuries after a vehicle collided with them.
Two of the firefighters were admitted to hospital as a precautionary measure but were released shortly afterwards.
It's long been recognised that landslips are one of the greatest risks to Britain's railways and that a changing climate will make them more likely.
Heatwaves and droughts can dry out the steep embankments beside the tracks, and over the years will start to weaken them.
Add to that the effects of heavy rain, of the kind seen just now in Scotland, saturating and eroding the soil, and undermining its strength.
And with rising global temperatures set to bring extremes of weather never anticipated by the Victorian engineers who built the lines, Network Rail has been studying how best to keep the tracks safe.
But it admits that "we know we can't rebuild every mile of railway".
The most recent multiple fatalities on the UK's railways were in South Wales in 2019, when two railway workers died after being struck by a Great Western train near Port Talbot. They were working without a lookout.
In November 2004, an intercity train travelling on the Reading and Taunton line hit a car on a level crossing, derailing a train and killing seven people and injuring more than 70 others.
In May 2002, an east coast main line train derailed because of an undetected points failure. Coaches rolled and came to rest on platforms. Seven people were killed and 76 injured.
In February 2001, 10 people were killed in the Great Heck Rail Crash near Selby when a train struck a Land Rover that had rolled onto the track because the driver had fallen asleep, and was derailed into the path of another train.
In October 1999, at Ladbroke Grove in London, 31 people were killed in a head-on collision after a driver passed a signal.
Are you in the area? Did you witness the incident? If it is safe to do so please share your experiences by emailing firstname.lastname@example.org.
Please include a contact number if you are willing to speak to a BBC journalist.