Image copyright Getty Images Image caption Ruth Davidson has led the Scottish Conservatives to a hat-trick of electoral successes in just over a year

Ruth Davidson has just led the Scottish Conservatives to their best result in a Westminster election since 1983, and has appeared among the bookies' favourites to succeed Theresa May as Tory leader. But who is she?

The 38-year-old has only been a Conservative Party member since 2009, and an MSP and Scottish Tory leader since 2011 - but she has already turned the party's fortunes around almost entirely.

Without her Scottish Tories gaining 12 seats north of the border on 8 June, Mrs May would not be forming a government right now. George Osborne called her the "heroine" of the election for the Conservatives.

In a country where the party has been a toxic brand since the days of Margaret Thatcher, this is a truly remarkable turnaround.

And the Westminster vote is just the latest in a speedy hat-trick of electoral successes for Ms Davidson.

She has delivered huge improvements for her party in Scottish Parliament and local authority elections in 2016 and 2017 respectively, leapfrogging Labour into second place in both polls.

And now, with her star shining more brightly than ever, she appears intent on wielding influence at Westminster - over Brexit in particular.

Image copyright PA Image caption Ruth Davidson's Scottish Tory MPs could make the difference for the party at Westminster

Born in Edinburgh and raised in the Borders and Fife, she studied at Edinburgh University before pursuing a career as a journalist. She worked at Kingdom FM in Fife, before moving to BBC Scotland in Glasgow in 2002.

She was not particularly political in her youth, but once she did join the Conservative Party - in 2009, after leaving the BBC to study International Development at Glasgow University - her rise was a rapid one.

She stood unsuccessfully in Glasgow North East twice in quick succession, in a by-election in 2009 and then in the 2010 general election. She worked for a time as an aide to then Scottish Tory leader Annabel Goldie.

In the 2011 Scottish Parliament election, Ms Davidson then ran in the Glasgow Kelvin constituency.

She finished a distant fourth, but was elected to Holyrood via the regional top-up list system - having been promoted to the top of the list only after Malcolm Macaskill stood down.

Image copyright PA Image caption Ms Davidson is an energetic campaigner

The new MSP was provided with an immediate opportunity for further advancement. After the election, which saw the Tories drop two seats as Alex Salmond's SNP surged to an unprecedented majority, Annabel Goldie resigned.

Ms Davidson, then aged 32, was one of four candidates for the job. Her most prominent opponent was Murdo Fraser, an MSP and fan of federalism who proposed splitting the Scottish group off from the UK party as a new fully autonomous party.

He had the backing of a number of MSPs, as well as a pair of former Scottish secretaries in Malcolm Rifkind and Peter Duncan, while his federalism proposal was backed by Tory figures including Michael Gove, Norman Tebbit and Daniel Hannan.

Ms Davidson, meanwhile, was endorsed by Scotland Office Minister (and later Scottish Secretary) David Mundell, as well as a handful of MSPs and peers.

The election was run using the single transferrable vote system and saw Ms Davidson take 40% of first-preference votes to Mr Fraser's 36.9%. After a second round of counting, she was declared the winner in November 2011.

First interview following leadership election - 'We are a country with its best days ahead of it'

Media playback is unsupported on your device Media caption Ruth Davidson's first interview as Scottish Tory leader in 2011

The 2014 Scottish independence referendum was where the Tory revival really began.

Ms Davidson was part of the Better Together campaign during the poll, which finished with the No side winning by 55% to 45%.

In the aftermath, as the SNP surged and Labour collapsed, she shaped her party firmly as the defenders of the Union, seeking to sweep up support from the 55%.

There wasn't an immediate bounce - in the 2015 general election it was the SNP who dominated, winning 56 of Scotland's 59 Westminster seats. The Conservatives took one - but they were starting from a very low base, having won at best a single seat in each contest since 1992.

Image copyright PA Image caption Ms Davidson has a fondness for a wacky photocall

Image copyright Getty Images Image caption Ruth Davidson is an energetic campaigner, up for most things, including a shot at playing the bagpipes

But with the issue of the union continuing to play a major role in Scottish politics, Ms Davidson's strategy was to pay off in style in the 2016 Holyrood elections.

Ahead of the poll, Ms Davidson announced she was switching constituency, from Glasgow to Edinburgh.

A politician known as an energetic campaigner, she was often the subject of colourful photo opportunities - including standing astride a tank flying a union jack flag.

For the 2016 campaign she rode a buffalo, played ice hockey, pulled countless pints and drove everything from a racing car to a crane to a snowmobile.

Not only did she score an unexpected victory in Edinburgh Central, gaining the seat from the SNP, her Tories leapfrogged Labour into second place.

They captured 31 seats, more than doubling their previous total, with Labour dropping to 24. The SNP lost their overall majority, but remained by far the largest party.

The binary issue of independence had turned Scottish politics into a two-horse race - and with the Tories dominating the pro-Union side of the debate, they largely squeezed Labour out of contention.

Image copyright Getty Images Image caption Ruth Davidson was a leading voice in the Remain campaign across the UK

This left Ms Davidson as the main sparring partner for First Minister Nicola Sturgeon at weekly question sessions, giving her a new platform.

While defence of the union and opposition to a second independence referendum remained at the core of the Scottish Tory approach, Ms Davidson broadened her attacks to focus on education in particular. With the SNP heading into its tenth year in government, the Tories were able to effectively campaign as an anti-establishment force in Scotland, despite also being in power at Westminster.

Hot on the heels of the Holyrood election though was the EU referendum - and here, Ms Davidson found herself on the same side as Ms Sturgeon.

The two women became leading voices in the Remain campaign, with Ms Davidson putting in a typically muscular performance while repeatedly clashing with Boris Johnson in a TV debate days before the vote.

Media playback is unsupported on your device Media caption EU Referendum: Davidson and Johnson close Great Debate

The result was a disappointment to the Scottish Tory leader - but she adapted, positioning herself on the soft-Brexit wing of the ensuing debate, continuing to advocate single market access.

In the subsequent Conservative leadership contest, triggered by the resignation of David Cameron, some called for Ms Davidson to seek a move to Westminster.

She ruled that out - "for now" - saying that she had a "pretty bloody big job" in Scotland, instead endorsing the candidacy of Theresa May.

She has eye on a different prize - becoming First Minister of Scotland in 2021.

Image caption Ms Davidson gets a weekly chance to grill Nicola Sturgeon as leader of the largest opposition party at Holyrood

However, that is not to say she is taking no interest in Westminster politics.

The morning after the election, as Mrs May drew criticism for barely mentioning the result as she grimaced for the cameras outside Downing Street, Ms Davidson was making a speech rallying the troops.

She conceded that the party hadn't lived up to expectations UK-wide, was magnanimous towards her opponents and talked of building consensus.

Significantly, she also laid out some policy ideas about an "open Brexit", prioritising protecting business.

And as Mrs May discussed a deal with the DUP, Ms Davidson confirmed she had spoken to the prime minister seeking assurances that any agreement wouldn't impact on LGBTI rights.

There is a plurality of views on Brexit and other issues among the 13 Scottish Conservative MPs, but all are loyal to Ms Davidson. In a parliament of razor-thin margins, she now wields considerable influence over the future direction of the UK government.

Image copyright AFP Image caption Ruth Davidson got engaged to Jen Wilson in 2016 - but they delayed their wedding to pay vet's bills after their dog was hit by a car

Outside of politics, Ms Davidson was quickly marked out as not being a "typical" Tory - often being referred to instead as a "kickboxing lesbian".

She lives in Edinburgh with her partner Jen Wilson and their cocker spaniel, also called Wilson, who was hit by a car in 2016, leading the couple to postpone their wedding to pay for his care.

She has referred to LGBTI rights as one thing she cares about more than her party - the other being her country. She is also a member of the Church of Scotland.

Ms Davidson has built herself a profile on national television, appearing as a panellist on programmes including Have I Got News For You and The Great British Bakeoff: Extra Slice.

She has a keen interest in sport - her father was a former Partick Thistle player - and supports Dunfermline Athletic. She was a member of the Territorial Army, before a back injury forced her to withdraw.

Image caption She has appeared on Have I got News for You

Having turned Tory fortunes around in Scotland on each of the electoral fronts - in the country's councils, at Holyrood and at Westminster - some are now asking what comes next for Ms Davidson.

From here, things only get harder. When she came along, the party was more or less at rock bottom. Expectation levels were near zero.

But now, established as the second force in Scottish politics, the pressure is greater. In future her troops will have to defend the seats they hold as well as fighting to make gains.

The party still has a way to go to the next level, too - they may have climbed to the main opposition spot at Holyrood, but the SNP have more than double their number of seats. Bute House remains a distant prospect, for now.

After all, if indyref2 really is "dead", as Ms Davidson posited on election night, what does it mean for a Tory revival founded centrally on that very issue?

On the Unionist side, Labour are also looking buoyant, regaining seats lost to the SNP tide in Scotland and snapping at Mrs May's heels at Westminster. The Lib Dems have also made gains.

But it's fair to say that for now at least, Ms Davidson has momentum on her side. She also relishes any kind of challenge.

As she told activists ahead of the snap election: "It's not the size of the dog in the fight, it's the size of the fight in the dog."