ScotRail has come under fire from angry passengers amid major disruption to services to and from Edinburgh on Saturday night.
People travelling from Waverley and Haymarket complained that services were cancelled and trains were “dangerously overcrowded”.
Transport Scotland said the problems were “unacceptable” and that the ScotRail Alliance was carrying out an immediate investigation.
ScotRail has apologised.
The rail firm said it did all that it could to meet demand on an extremely busy evening.
It was the last weekend of the Edinburgh festivals and Murrayfield hosted an international rugby match.
Scores of passengers have taken to Twitter to criticise the ScotRail, claiming they failed to plan for the busy weekend.
BBC Scotland has also received many messages from people caught up in the chaotic scenes at stations and on board trains.
Transport union TSSA called on Michael Matheson, Scotland’s transport secretary, to launch an inquiry into the issue.
A Transport Scotland spokeswoman said: “Ministers are taking this matter very seriously and are quite clear that last night’s incidents are unacceptable.
“The ScotRail Alliance is already carrying out an immediate investigation into what occurred to provide answers as soon as possible.”
Passenger Gill Craig said a number of trains to Glasgow Queen Street from Edinburgh Waverley were cancelled before she was finally able to board.
“Levels of overcrowding on the platforms and on the trains were dangerously high,” she said.
“Surely ScotRail could have anticipated that the last Saturday of the Festival/Fringe and a rugby international would have required extra trains?
“How could two trains between Edinburgh and Glasgow, which should have been at least seven coaches long, be cancelled at such short notice?
“The public need answers. We need to be confident that this dangerous situation will not happen again.”
Gillian Broderick said her two children were crushed against the train door when they arrived a Haymarket and people tried to get onboard.
“They could see there was no room but would not be deterred,” she said.
“Verbal abuse, physical abuse, bags pushed into my children’s faces. Absolutely disgusting behaviour from people who showed no concern for the safety of others including children and babies.
“Station staff couldn’t do anything. Police were nowhere to be seen.”
She said she eventually pushed the emergency button as she did not her children in such a “powder keg” environment. They got a taxi home.
“I will definitely rethink taking my family on the train in the future,” she added.
Lesley Eadie told the BBC Scotland website that passengers were “packed like sardines” on her train from Edinburgh Waverley to Glasgow Queen Street.
At one point she saw passengers pass a baby along the carriage, from the child’s father to his mother.
“The family had sat down and the dad took the child – who was maybe 18 months or two years old – to the toilet,” she said.
“When they got out the train was so packed, he couldn’t get back to his seat.
“The passengers were just passing this baby back to his mother.”
BBC Scotland’s Douglas Fraser on his journey from Edinburgh to Glasgow
Trying to get to Glasgow from Edinburgh at 21:30, I realised I’d never get space on a train at Haymarket, so I took a train back down the line to Waverley. The station was heaving with Fringe and Festival-goers, boozed up youths after a warm day’s lager consumption, and many Murrayfield stragglers.
Rail staff refused to give platform allocations for fear, one told me, of too many people crowding platforms. There was tension, and that sense of risk when crowd behaviour feels unpredictable. As Fife trains were cancelled, I heard people heading for the taxis. When I finally got a train, there was a stramash between people trying to get onto the next carriage. That brought an admirably quick rail staff and police response.
I was pressed against the door with another 19 people standing in the door area. This was the slow train through Caldercruix and Coatbridge Sunnyside, stopping 19 times before Glasgow. At least we got some fresh air at each stop. And then a very long taxi queue, so it was the night bus for me. I arrived home two hours later than planned.
Another passenger, Jill Davis, told BBC Scotland she was concerned for safety on the train home to Glasgow.
“It was really dangerously, dangerously overcrowded,” she said.
“There were children standing, I had my bike with me. It was just awful – really, really terrible.”
Harry Fisher said staff were shouting at passengers to move further along the carriages of his train to Aberdeen – despite the fact there was nowhere to go.
“They didn’t care, just shouted louder,” he said.
“They were incredibly aggressive and had actually lost the plot. I had to stand until Dundee. I’m 64, a chap next to me was 74. We were both fit enough to stand, but still…”
The experience has led to questions about the maximum number of passengers train operators are allowed to carry in carriages.
ScotRail told BBC Scotland: “While there’s no legal limit on the number of passengers that can travel in a carriage, we wouldn’t let services operate unless it was safe to do so.”
At the height of the disruption ScotRail was encouraging people travelling from Edinburgh city centre to consider making alternative arrangements.
A spokesman for the firm said: “We’re sorry to our customers who experienced disruption and busy services yesterday.
“We do all that we can to meet demand. Every available train we have was out on the network to get our customers where they needed to be.
“Customers delayed by 30 minutes or more are encouraged to claim for money back via our Delay Repay Guarantee on our website or mobile app.”
Were you affected by the disruption on the trains to and from Edinburgh on Saturday night? If you would like to share your story or pictures, please email email@example.com.