For a batsman to be out leg before wicket, the umpire must decide that the ball has hit the batsman on the body and would have gone on to hit the stumps, subject to certain conditions.
The bowler should have bowled a legal delivery - not a no-ball.
If the ball has pitched, it should not have pitched outside the line of leg stump.
The ball should hit any part of the batsman - not just the legs - apart from the hand holding the bat, in line with the stumps; unless the umpire decides the batsmen isn't playing a shot, in which case the impact of the ball on the pad/body can be outside the line of off stump as well, but not outside leg stump.
The umpire must then decide whether the predicted trajectory of the ball would have taken it on to hit the stumps.
However, if the ball has touched the bat or the hand holding the bat, before hitting the body, the batsman can't be lbw.
It wasn't always like this, though.
The earliest known version of the laws of cricket was compiled in 1744. The lbw did not exist then. Because bats of the time were curved, it was believed that batsmen did not stand in front of the stumps in order to hit the ball better. There did not seem a need for the leg before wicket.
Bats eventually got straighter and batsmen began standing closer to the stumps. Without anything to dissuade them from kicking away that screaming yorker, they increasingly began protecting their stumps with their pads.
It wasn't until 1774, though, that the first lbw law was devised. It read: "The striker is out if he puts his leg before the wicket with a design to stop the ball and actually prevent the ball from hitting it." No mention of where the ball needed to pitch or hit the batsman, and the phrase "design to stop the ball" indicated that the batsman's action might have to be intentional.
In 1839 the MCC, by then the body responsible for the laws, decided that if the ball pitched, it needed to pitch in line with the stumps for a batsman to be lbw. So if the ball landed outside off or leg stump, the batsman could use his pads as a second line of defence to protect his stumps, without worrying about being lbw. The law remained unchanged for nearly 100 years, though there were several attempts to modify it during that time.
On February 7, 1888, a meeting of the County Cricket Council was held at Lord's to debate the lbw rule, among other issues. The problem, as reported by Wisden, was that, "with the introduction of slow round-arm bowling, and with the great work some bowlers were able to get on the ball, the very objectionable practice had arisen of batsmen standing in front of the wicket, perhaps with the bat over the shoulder, and stopping with their legs a ball that would have hit the wicket." They sent a proposal to the MCC for consideration saying that where the ball pitched should be irrelevant for an lbw.
While the MCC did not amend the law, it condemned the use of pads as a method of defence but could not eradicate the practice. In 1902, the MCC voted on whether to give the batsman lbw irrespective of where the ball pitched, but the motion did not receive the necessary two-thirds majority to change the law, though it did have a simple majority. The ball still had to pitch in line with the stumps for an lbw.
"The statistics reveal that in 1870 the lbw ratio was as remote as 1 in 40," Rafi Nasim wrote in 2000. "It further dropped to 1 in 67 by 1882-84 when the Australian bowler Fred Spofforth took 404 wickets of which only six were lbw. It would be interesting to know that by 1980 the ratio rose to 1 in 6."
Between 1900 and 1930, much like today, there were concerns that cricket was becoming increasingly batsman-friendly. With batsmen leaving or padding away deliveries that pitched outside off, controversial tactics like Bodyline began to develop. Harold Larwood, the chief exponent of leg-theory, was of the view that lbws needed to be given for deliveries that pitched outside off stump.
In 1935, it was decided to trial an alteration to the lbw law, and allow batsmen to be given out leg before to deliveries that pitched outside off stump. "Facts cannot be denied and we find that of 1560 leg-before-decisions favourable to the bowler in first-class matches last season, 483 were under the new rule," Wisden reported in 1936. "In the County Championship fixtures there were 1273 instances of a batsman being out lbw and of these 404 were due to the operation of the amended law.
"The swerving ball and the break-back each took toll of doubtful batsmen, but very soon much of the uncertainty as to what to do with the well-pitched-up ball disappeared. After being a few times in trouble, batsmen became alive to the need of depending upon the bat to deal with likely break or swerve - and this for the most part meant getting to the pitch of the ball. Quick footwork and the straight bat were used to solve the difficulty and if these genuine methods in the art of batsmanship failed, the bowler very rightly earned the verdict he deserved.
"The definite results reached last summer in so many matches, the reduction in scoring with consequent livening up of the game and obvious progress towards a finish pleased the majority of cricket lovers."
In 1937, the MCC passed the alteration to the law and batsmen could now be given out even if the ball was pitching outside off stump. After World War II, however, it was observed that the new law had led to a proliferation of offspinners and seamers, who could pitch outside off stump and break the ball back into a right-hand batsman to earn an lbw or a catch with a packed leg-side field, at the expense of left-arm spinners and legspinners. The MCC imposed a limit on the number of catchers on the leg side to try and restore balance.
The 1937 amendment, though more beneficial to bowlers, allowed batsmen to thrust their front leg outside the line of off stump to defend deliveries with the pad, a practice that grew increasingly prevalent in the 1950s and 1960s. The impact of the ball on the pad would be outside off stump, which eliminated the possibility of the lbw. After trials in Australia, the West Indies and England, the MCC in 1980 amended the lbw law to say that batsmen could be given out if the ball hit the pad outside off stump but was going on to hit the stumps, provided the batsman was not offering a shot. This is the version of the law as it stands today.
In 2008, however, the ICC trialled the Decision Review System (DRS), which was designed to give a team a limited number of referrals against an umpire's decision if they felt it was incorrect. The use of ball-tracking technology to predict the path of the ball after its impact on the pad has reduced the role of human prediction in lbws to a certain extent. The system was formally adopted in Test cricket in 2009, though its application is not yet uniform.