Two populist parties with opposing views of the world defeated the Labour Party in a district it had held since 1931.