Ministers have ordered ScotRail to improve following a surge in cancellations.
The rail operator has been given eight weeks to turn around its performance in an official notice issued by the Scottish government.
It relates to a series of cancellations around Edinburgh, Fife and the Borders between 11 November and 8 December.
ScotRail said its staff were working "flat out" to improve the service for customers.
The move follows weeks of disruption to rail services, with passengers complaining of cancellations, delays and overcrowded carriages.
The Scottish government said the remedial notice also applies pre-emptively to ScotRail's overall performance.
Ministers expect the operator will fail to meet its required performance level during December and early January.
A new timetable was introduced on 9 December, promising 100 new services and faster trains.
But a week later ScotRail boss Alex Hynes apologised for further disruption and pledged to make improvements.
And last week First Minister Nicola Sturgeon branded the delays and cancellations endured by ScotRail passengers as "unacceptable".
Now the Scottish government has issued a formal notice giving ScotRail eight weeks to submit a remedial plan, outlining how it plans to address its performance issues.
Transport Secretary Michael Matheon said: "We have stressed many times that ScotRail must improve, but too often passengers have been left disappointed.
"This month should have been a celebration of the biggest increase in services and capacity, enabled by our ambitious electrification programme.
"Instead, we are taking this contractual step of issuing a remedial plan notice.
"ScotRail recognises the reasons for this notice and the importance in returning performance across our rail network to contractually acceptable levels.
"Passengers want and deserve a railway which delivers the benefits of more seats and services on a consistently reliable basis."
Mr Hynes, the managing director of ScotRail Alliance - a partnership between Abellio ScotRail and Network Rail - confirmed that the operator would comply with the Scottish government's order.
He said: "We know that the service our customers have received hasn't been good enough recently.
"Everybody at the ScotRail Alliance is working flat out to deliver the improvements our customers expect and deserve.
"ScotRail will submit a remedial plan to Transport Scotland within the eight week timescale outlined."