Sir Dawda Jawara, who has died aged 95, was the first leader of the small west African country of the Gambia when it became independent in 1965. Although he was hailed as a rare democratic leader at a time when Africa was better known for military regimes and single-party states, he was twice overthrown in military putsches.

The first time, in 1981, he was reinstated as president by troops from neighbouring Senegal, while the second time, in 1994, nobody came to his aid and he left the country for eight years. But he was still well respected, and on his death was acknowledged by the current democratically elected president, Adama Barrow, as the Gambia’s founding father.

The Gambia was the last country in west Africa to achieve independence from Britain and, like many other former British colonies, initially had Queen Elizabeth as head of state represented by a governor general. In 1966 Jawara’s People’s Progressive party won 24 of the 32 seats in the national assembly, and he was knighted in 1966. Four years later a referendum led to the Gambia becoming a republic within the Commonwealth. Jawara became executive president, and in 1972 won a landslide electoral victory.

For the next 20 years the PPP dominated the political landscape, other opposition parties never building serious support. Jawara’s instincts were always for a pro-western liberal democracy. A persuasive speaker, his mild manner and occasional air of indecision masked a ruthless streak when his power was threatened.

During the 1970s the country supplemented its groundnut economy by diversification, with a prosperous tourism business. There was also a bonus from the informal economy, which the Gambia’s neighbours in Senegal saw as taking advantage of the enclave nature of the Gambia’s geography (it was described as an “arrow pointed at the heart of Senegal”). Although the two countries agreed on a cooperation treaty with a joint secretariat, hawks in Senegal advocated a more robust approach, with closer Senegalese influence over the Gambia’s affairs.

Their opportunity came as Jawara ran into political trouble in 1981 through complacency. The weak link was the Field Force – a glorified police unit established at independence because Jawara had not wanted a fully-fledged army.

Even a Field Force can develop discontents, and in July 1981, when Jawara was in London for the wedding of Prince Charles and Lady Diana Spencer, a Field Force mutiny led to a Senegalese military intervention, to put down what had become an attempted coup. The mutineers were linked to a group of radicals led by Kukoi Samba Sanyang, and had taken a number of hostages, including the president’s senior wife. After the Senegalese intervention, when the rebels fled or were arrested, she was released by a unit of the British SAS.

The attempted putsch diminished Jawara’s prestige, especially as there had been a heavy loss of life. The price of Senegal’s intervention was not just a continued military presence but also the establishment in 1982 of a Senegambian Confederation, in which Senegal’s president, Abdou Diouf, was confederal president, with Jawara as his vice-president.

Sir Dawda Jawara, rear centre, with other delegates to the Commonwealth prime ministers’ conference at Marlborough House, London, 1969. Photograph: AP

The confederation was not popular in the Gambia, not least because for the first time the country had an army (as part of a confederal force) and when, in 1989, Senegal clashed with its northern neighbour Mauritania, Jawara chose to force a crisis over confederal institutions. Diouf could have resisted, but he let the Gambia withdraw peacefully from the confederation. However, the Senegalese never forgave Jawara’s defiance.

At the 1991 PPP congress Jawara proposed that he would not stand at the next election. After a wave of emotion in the party, he abandoned his attempt, and ran again for another term. However, in July 1994 a bloodless coup was staged by a young lieutenant in the military police, Yahya Jammeh, who had returned from training in the US two months before.

In an interview in his house in Haywards Heath, West Sussex, three months later, Jawara told me the US ambassador had offered him sanctuary on a US naval vessel that had been carrying out joint exercises with the Gambians. He had thought it was a tactical move, but he found that all his family had already been evacuated to the vessel. However, he did not allege US complicity.

Jawara was born at Barajally on MacCarthy Island in the Gambia river. Originally named Saikou Almami, he was one of six children of a Mandinka trader. Although the family was Muslim, he was sent to the colony’s capital, Bathurst (now Banjul), to stay with a friend of the family, a trader, while he went to the Methodist boys’ grammar school.

After working as a trainee nurse for a year, he went to study science at Achimota in the then Gold Coast (now Ghana). From there he won a scholarship to Glasgow University in 1948 to train as a veterinary surgeon, the first Gambian to do so. After qualifying in 1953, he returned home to work as a veterinary officer for the next six years.

At Glasgow he was president of the African Students Union. After converting from Islam to Christianity in 1955, he took the name David and married the daughter of the speaker of the Gambia’s house of assembly, Sir John Mahoney. His wife, Augusta, helped launch him into local politics. However, his reconversion to Islam in 1965 led to their divorce, and his marriage to two more wives.

In 1959 he joined an upcountry group called the Protectorate People’s party and soon became its leader, changing its name to the People’s Progressive party. He stood for election in 1960, won his seat and was appointed minister of education, but resigned when PS Njie, the leader of the other main political party, was chosen as the transitional chief minister although the PPP had won more seats.

The British, by then intent on decolonising this poverty-stricken country of half a million people, brought in a new constitution for independence. After further elections in May 1962, the PPP won a narrow majority, and Jawara became chief minister. After self-government came in October 1963, he was prime minister.

The British, working with the French and the Senegalese, brought in the United Nations to report on prospects for independence, and, though a federal union with Senegal was recommended as the best option, the young turks in Jawara’s own party pressed him to opt for going it alone. Thus, in spite of concern at the viability of the new state, the British granted independence in February 1965.

When Jawara’s time as first leader of the independent country came to an end, he went first to Senegal (whose government had conspicuously failed to intervene) and then to exile in Britain. He maintained a half-hearted posture of criticism of Jammeh’s regime, even when it returned to a pseudo-constitutionality, but in 2002 Jawara decided to return home, and seek reconciliation with his successor.

This was a kind of humiliation but, at nearly 80, he felt he had no further political role. His return permitted him to enjoy some minor standing as a retired statesman, and in 2010 he published Kairaba, an autobiography.

He is survived by two wives and several children.

• Dawda Kairaba Jawara (Saikou Almami Jawara), politician, born 16 May 1924; died 27 August 2019

• Kaye Whiteman died in 2014