In 1965 the Conservative Party introduced a procedure for electing the party leader through a ballot of all Conservative MPs.
Before that, Conservative leaders had simply "emerged" following private consultations among senior party members.
When in 1975 the party became disillusioned with Sir Edward Heath, who refused to resign despite electoral defeats, the rules were changed to allow an annual challenge to the leader.
Further changes were made in 1990-91 to make it more difficult for rogue challenges to be made by "stalking horse" candidates - those with little or no hope of winning, but who wished to make a point or pave the way for a more realistic candidate to step in at a later stage.
After the Conservatives' catastrophic defeat in the 1997 General Election, William Hague was elected leader under the existing rules.
These meant that to win in the first round, a candidate had to get a majority of the votes and a margin of 15% of those entitled to vote over his or her nearest challenger.
Mr Hague came second of the five candidates in the first ballot with 41 votes out of 164 - Kenneth Clarke led with 49. Two candidates then dropped out voluntarily.
In the second round, victory would go to any candidate who gained an overall majority. In the event, Mr Hague again came second with 62 votes to Mr Clarke's 64.
Under the rules, third-placed John Redwood then had to drop out, leaving the third round as a straight fight between the two top-placed candidates. Mr Hague beat Mr Clarke by 92-70.
The current rules
During his campaign, Mr Hague proposed to reform the leadership election rules to give ordinary party members more say.
Mr Hague's reforms were introduced in January 1998, and first used following his resignation in June 2001.
Now, when more than two candidates are proposed, initial ballots of Tory MPs are held with the lowest placed candidate dropping out at each round until only two remain.
The final two contenders - David Cameron and David Davis in 2005 - are then voted on by every paid-up member of the Conservative Party in the country.
As well as the resignation or death of the leader, there can now be a leadership election if 15% of Conservative MPs call for a vote of no confidence in the current leader.
If the leader then wins a simple majority in a vote of MPs, then he or she continues in office. If defeated, they cannot stand for re-election and MPs will vote again in a primary election for new candidates.