The Middleton and Prestwich by-election, 1940 was held for the Middleton and Prestwich constituency on 22 May 1940.
The by-election was held during World War II, and five of the largest political parties – Conservative, Labour, Liberal, National Labour and National Liberal agreed to an electoral pact not to contest any by-elections in seats held by any of the other parties.
The British Union of Fascists (BUF) had contested several recent by-elections, receiving very few votes. During the mid-1930s, the group had been able to organise sizeable demonstrations, but anti-fascist activity and the banning of political uniforms by the Public Order Act 1936 had hit the group hard. The BUF's main message was to call for immediate peace and a pact with the Axis powers; during the "phoney war" period this message had been received calmly. The British Union selected Frederick Haslam, who was 43 years old and working as an engineering designer. Haslam had served in France and Palestine during World War I and had won the Military Medal when fighting on the Somme.
However, by the time that the Middleton and Prestwich campaign started, the British Army was fighting the Germans in Norway; on 9 May, the Germans invaded France through the Low Countries. The sudden escalation in the war made the BUF seem like fifth columnists, and the seizure of power in Norway by Vidkun Quisling was a matter of extreme concern because Quisling's career was superficially similar to that of Oswald Mosley. When Mosley spoke in Middleton and Prestwich, missiles were thrown at him and people tried to hit him. The British government was also preparing to make the BUF illegal under wartime powers, and arrested several Fascist activists in the run-up to the election.
Nairne Stewart Sandeman had held the seat for the Conservative Party since the 1923 general election, and had won more than 60% of the vote in the 1935 general election against a Labour Party challenge. The party chose Ernest Everard Gates to contest the by-election. With only Fascist opposition, the election was expected to be an easy win for Gates.
Gates won resoundingly, with 98.7% of the votes cast and a 97.4% majority: an all-time record for any contested UK parliamentary by-election, and the largest majority in any parliamentary election since East Kerry in the 1885 general election.
The BUF was banned the day after the election, and its remaining leaders interned.