Cheshire is often viewed as a Conservative place so when Tory politician John Dwyer was elected as the county's first ever Police and Crime Commissioner in 2012, it was no great surprise.

Fast forward to the 2016 election and there was a degree of shock last Friday (May 6) when Mr Dwyer's majority was overturned by the Labour victor David Keane following what turned out to be a two horse race with the Lib Dems and Ukip left trailing.

Chester-based freelance data analyst John Murray presents his view of what went right for Labour and wrong for the Tories.

Data analyst John Murray

Labour’s David Keane won the 2016 Cheshire Police and Crime Commissioner election, overturning the incumbent Conservative John Dwyer’s 2012 comfortable majority of 11,241 (10.3%), to win with by 2,949 votes (1.6%).

As the count commenced on Friday May 6, it became apparent to observers that the contest was going to be much closer than in 2012.

Related story: Labour wins Cheshire Police and Crime Commissioner election battle

So what changed?

The lack of an independent candidate in 2016 was bound to have a bearing on the result, although BBC political reporter Phil McCann suggested this probably helped the Conservatives.

John Dwyer who was ousted as Cheshire Police & Crime Commissioner

The 2012 elections were dogged by poor turnout due to public apathy with only 14% of those eligible to vote in Cheshire taking part. In 2016, the turnout increased to 23% but with two of the four borough councils in Cheshire - Halton and Warrington - holding local elections on the same day, turnout rose sharply in these area creating a significant imbalance favouring Labour supporting areas.

In Cheshire East, turnout rose slightly from 17% to 21%, in Cheshire West and Chester turnout jumped from 13% to 20%, but the two boroughs with local elections saw their turnout rise more than two-and-a-half times from 10% to 26% in Halton and from 13% to 33% in Warrington.

This meant that the two smaller boroughs gained a significantly larger share of the overall vote than in 2012, completely changing the dynamics of the election.

The Cheshire PCC election, turn-out by borough, comparing 2012 with 2016. Graphic by John Murray

The impact of this change in distribution can be seen when the 2016 result is broken down into party share by borough:

Distribution of first round votes in the Cheshire PCC 2016 election by party within each borough and aggregated across the county. Graphic by John Murray

Labour gained ground in all but Cheshire East where the Conservative lead increased by 1.8% to 22.5%. In Cheshire West and Chester, Labour’s share of the vote increased by 11.4% to 37.5%, while the Conservative share went up by 1.6% to 43%, narrowing the gap from 15.3% to 5.5%, a swing to Labour of 4.9%. In Halton and Warrington, Labour increased their lead by 2.3% and 7.4% respectively.

Related story: New Cheshire Police and Crime Commissioner supports Corbyn

The Conservative candidate polled 12,330 second preference votes, 226 more than Labour, but this was insufficient to turn around Labour’s first round majority of 3,175.

A combination of a surge in Labour’s performance in three of the four boroughs, particularly Cheshire West and Chester, and the impact of local elections on turnout secured a Labour win in what was previously thought to be a safe Conservative area.