First ScotRail took over running the rail network four years ago
The finance boss of Scotland's transport quango has quit after a report by audit watchdogs into the running of the Scottish rail franchise.
Transport Scotland said Guy Houston had stepped down with immediate effect.
The Audit Scotland report found First ScotRail had improved the quality of train services across the country since taking them over four years ago.
But it criticised the handling of the extension of the contract until 2014 and a "potential conflict of interest".
Mr Houston joined the transport body in May 2006 and his salary last year was in the range of £90,000 to £95,000.
A section of the report said Transport Scotland's register of interests indicated that its finance director held shares and share options in FirstGroup, the parent company which operates ScotRail and an extensive bus service.
It said Mr Houston was present at key meetings in March at which the rail franchise extension was discussed.
The report said Transport Scotland's chief executive had insisted Mr Houston had no vote on any decision-making relating to FirstGroup and was not involved in the review process.
Labour transport spokesman Des McNulty said it was an "unacceptable conflict of interest" that Mr Houston was allowed to sit in on the meetings.
Liberal Democrat transport spokeswoman Alison McInnes said: "I am concerned that the report identified weaknesses in the management of any potential conflict of interest."
She said the renewal of the contract was a "deeply flawed" process.
Rail unions and MSPs hit out at the lack of transparency over the ScotRail extension when it was announced in April.
It said the government should have waited for the Audit Scotland report into the way the firm was running the franchise before awarding the extension.
Auditor General Robert Black's report said: "First ScotRail has run services well since taking over in 2004.
"Delays are down, passenger numbers and satisfaction are up and the quality of service, both on trains and at stations, has improved."
The First ScotRail franchise covers 95% of Scotland's passenger train services and the long distance sleeper between Scotland and London.
The report said First ScotRail, which will receive £2.5bn in government subsidy over the 10-year franchise term, is doing a good job in running services, service quality is good and improving in most areas.
However, Transport Scotland is criticised for not consulting on the franchise review with external bodies.
The report said Transport Minister Stewart Stevenson was not presented with a fully documented business case.