Scotland's first coalition government almost didn't happen, former Deputy First Minister Jim Wallace has revealed.

It's nearly two decades since Labour and the Liberal Democrats formed an administration following the first Holyrood elections in 1999.

In a special 20th anniversary programme available on the STV Player from later today:

Immediately after the 1999 poll, in which Scottish Labour won 56 seats and the Scottish Liberal Democrats 17, Wallace and then-Scottish Secretary Donald Dewar sat down to negotiate a coalition agreement.

Wallace was concerned that a small, but potentially problematic, minority in his party were against a formal agreement.

He said: "I can remember at least two occasions during the coalition talks when I folded over my notepad and said, 'well Donald, I think we have given it our best try. I just don't think this is going to work'."

A key issue in those talks was whether or not tuition fees should be abolished in Scotland - a move that could be embarrassing for the UK Labour government. The Lib Dems had made clear that abolishing tuition fees was non-negotiable.

Jack McConnell, who would later become First Minister, told STV that there was unease in the Labour ranks towards the end of the election campaign over funding higher education differently north of the border.

"That was when divisions started to appear between the Labour party in Scotland, who were trying to deal with the reality of the situation, and the Chancellor and others in Westminster who were a bit more nervous about the situation," the now Lord McConnell of Glenscorrodale said.

Labour and the Liberal Democrats eventually abolished the fees, opting instead for the introduction of a graduate endowment aimed at freeing money for poorer students but which was branded as tuition fees by the back door.

The 1999 election saw the SNP win 35 seats in the new parliament. The current First Minister was the defeated SNP candidate in the Glasgow Govan constituency.

Nicola Sturgeon told the programme: "You are always fighting to win. So when you don't there's a sense of disappointment. But looking back it was probably the result we were going to get."

Former Scottish Conservative leader Annabel Goldie said the elections were difficult for the party which had opposed devolution for so long.

She added that the choice was sticking its head in the sand or accepting the new reality; the party chose the latter.

The programme hears contributions from Sturgeon, former SNP MSP Andrew Wilson, Lord McConnell, former communities minister Wendy Alexander, Baroness Annabel Goldie, Lord Wallace and former Labour MP and Independent MSP Dennis Canavan.