One of the most extraordinary ideas to emerge in the short and tentative political life of post-devolution Wales was put forward in the spring of 2007, after elections for the Welsh assembly had left the incumbent Labour administration well short of a majority. The three opposition parties held talks that took them a long way towards an agreement for what became known as a rainbow alliance. What they would do next, it was suggested, was to go to the first minister, Rhodri Morgan, and tell him they had got a majority. At this point, the theory went, he would seize the opportunity to step down with dignity.

These were clearly people who had not been paying attention in the previous decade or so. Rhodri’s entire political career had been characterised above all by a refusal to step down. He was a man who did not know how to surrender and, as he was to demonstrate to his challengers in the following few weeks, one of the reasons was that he was a much more resourceful and ingenious politician than any of them.

Rhodri, who has died aged 77, towered over the Welsh political world from the day in 2000 when he unexpectedly succeeded to the leadership of the national assembly for Wales, a job he had been denied by his own party on two previous occasions. Invariably known by his first name, he was popular with the voters, while opinion polls showed that his opponents scarcely ruffled the surface of public recognition.

One reason for that was his presence. A tall man, strongly built, with a cartoonist’s dream of untameable Brillo pad hair, he was energetic, combative, funny and unstoppably loquacious.

Born in Cardiff, Rhodri was the son of Thomas, a leading scholar of the Welsh language, who published as TJ Morgan, and his wife, Huana, a teacher. From Whitchurch grammar school (now high school) Rhodri went to St John’s College, Oxford, where he took a degree in philosophy, politics and economics (1961), and then to Harvard for a master’s in government (1963).

Before becoming MP for Cardiff West in 1987, he was a Workers’ Educational Association (WEA) tutor (1963-65), a research officer for local and central government (1965-71), an economic adviser to the trade department (1972-74), industrial development officer for South Glamorgan (1974-80), and head of press and information for Wales for the European commission (1980-87). His style, although exhaustively well-informed, was down to earth, something emphasised by his devotion to sports of many kinds. Nor did he have any appetite for ostentation.

In 1967 he married Julie Edwards, who went on to become Labour MP for Cardiff North (1997-2010) and since 2011 has been Welsh assembly member for the constituency. They liked to spend their summer holidays in their caravan at Mwnt on the Ceredigion coast.

As first minister Rhodri was ubiquitous, of course, but there was admiration too for his determination, his refusal to stop battering against the door that people, in particular Tony Blair, kept holding shut against him. When Labour won its huge majority in May 1997, it was expected that Rhodri would get a junior job in the Welsh office, something he had been shadowing in opposition. Two days after the election he was still sitting at home waiting for the phone to ring. He was so distracted, he said, that for the first time in his life he tidied his sock drawer. The call from Downing Street never came and why he had been cold-shouldered remained a mystery. Rhodri himself thought it might have been the result of a tactless remark he had made to Blair, tactless remarks being something of a speciality of his.

In any case, if his career was blocked at Westminster, another path was opening up because of the narrow yes vote in the 1997 referendum to establish a Welsh assembly, something of which Rhodri had always been an enthusiastic supporter. In 1998 he challenged the then Welsh secretary, Ron Davies, for the leadership of the Labour party in Wales, and consequently for what would be the top job in the assembly after the first elections for it, in 1999. Davies won, but months later, following the incident on Clapham Common referred to as his “moment of madness”, he resigned.

Once again Downing Street would not wear Rhodri at any price. The Home Office minister Alun Michael was drafted in. Rhodri challenged him too, making an immediate entry into the books of quotations when asked by Jeremy Paxman on Newsnight if he would be standing. “Does a one-legged duck swim in circles?” Rhodri told his baffled interviewer.

However, being funnier than Michael was no use and the London Labour party machine mobilised the Welsh unions to keep him out. Rhodri did not hide his resentment but, when the assembly began work a few months later, with Rhodri the member for Cardiff West (and continuing at Westminster till 2001), he took one of the most important jobs in the administration, running economic development. Then, when the following year in a fit of irritated independence the assembly turfed Michael out, Rhodri finally got the leadership.

When he did so there was a widespread sense that somehow he had at last come into his rightful inheritance. Even many of those who did not agree with him had a feeling that justice had been done. In many ways he turned out to be the ideal man for his coveted post, not least because of his sheer appetite for the intricacies of political life. This was something that in the new Welsh dispensation turned out to be arduous and uncertain, because the assembly’s system of proportional representation meant that almost invariably Labour was running a minority government.

Rhodri never seemed to show any public alarm at this state of affairs. Sometimes he would bore his opponents into silence by his astounding grasp of every detail of his government’s activities. At others, if the mood took him, he would simply dish out abuse, making the term “bank manager”, for example, sound like a particularly grotesque perversion. He did not nag his ministers and he was notably reluctant to sack anyone.

The problem with his striking fluency and his mastery of detail was that it appeared to lead him into believing that he could tackle almost any problem or event without much by way of detailed preparation. His failure in 2004 to attend the ceremonies in Normandy to mark the 60th anniversary of D-day, when he might have stood alongside world leaders, provoked fierce public hostility. His refusal to say, on the BBC’s Question Time programme, whether he was for or against the Iraq war damaged his reputation among his own supporters, but his reaction, as often, was to carry on as if nothing much had happened.

It was the strategy of a politician who did not fear his opponents or the rather attenuated Welsh press. And he demonstrated his command of the system with particular brilliance when, after the 2007 election, Labour held only 26 of the 60 seats in the assembly. A deal had to be done. The Liberal Democrats were obvious partners, as they had been once before. But they drew away, preferring to work for a coalition with Plaid Cymru and the Conservatives. When that stalled for a moment, Rhodri struck.

While everyone else was talking he got the assembly to vote him back in as first minister. Then he worked on the traditional view in Wales, to which Plaid Cymru was eagerly receptive, that the Tories were the real enemy. To allow them into government, it was implied, was to invite the return of Thatcherism. Now was the time, he argued, for something called a progressive alliance. It echoed his established strategy of presenting his government as something of a leftwing affair, with clear red water between it and New Labour in London.

It worked. Sixty-five days after the election a coalition pact was sealed with Plaid Cymru, chipped away from their other would-be partners. Rhodri was back where he had always wanted to be, starting a third term in charge of government in Wales, with more power, thanks to legislative changes, than ever before.

The moment he chose to step down as first minister came in 2009, before, as he put it, he was pushed. He continued as an assembly member for another two years, and then retired fully from politics, at which point he became chancellor of Swansea University.

He is survived by Julie, a son and two daughters, and his brother, Prys.

• Hywel Rhodri Morgan, politician, born 29 September 1939; died 17 May 2017

• Patrick Hannan died in 2009