Poland’s conservative Law and Justice party is likely to unseat the liberal Civic Platform in October’s election, polls show. Partly this is because voters are eager for a change after eight years of Civic Platform rule. But Poland’s election outcomes are also shaped by the country’s history.

Law and Justice only recently overtook Civic Platform in the polls. In May, when the party’s Andrzej Duda unexpectedly won the presidential election, it was at 33 percent support. Now polls put it at 40 percent against 15 to 20 percent support for Civic Platform.

Prime Minister Ewa Kopacz is blamed by some for the ruling party’s demise. Even though she is personally popular, she is seen as lacking the common touch of her predecessor, Donald Tusk.

Between 2007 and 2014, when Tusk was prime minister, Civic Platform did not lose a single national election. After Tusk moved to Brussels to become president of the European Council, it lost two in eight months.

The Financial Times nevertheless argues that the government she inherited deserves much of the blame. “After seven years in office, Civic Platform began to appear to some voters as arrogant, out-of-touch and complacent,” it reports. Law and Justice, by contrast, used its time in opposition to woo the economically disenfranchised, such as pensioners and the low paid.

Poland’s economy is doing better than most in Europe and expected to expand 3.2 percent this year. But unemployment remains high at 10 percent and wages haven’t kept up with growth.

Law and Justice proposes to cancel a recent increase in the retirement age and double the income tax threshold to help lower incomes make ends meet.

The party is most popular in the poorer and more conservative east of Poland. Civic Platform, by contrast, gets most of its support from the west.

Polish history helps explain why.

When the country was carved up between Austria, Germany and Russia in the eighteenth century, the three powers treated their Polish provinces very differently. The Russians neglected economic development in the areas they got while the Germans invested heavily in what was then already the most Europeanized part of Poland.

Jan Cienski has argued at Politico that almost a century after Poland regained its independence, those differences still matter.

The crucial one is that in most of the east, today’s people are descendants of those who lived in the area for centuries. Enduring family and local ties makes for a more conservative society. The region along the Baltic was only given to Poland after 1945 when most of the prewar German population was evicted. They were replaced by refugees, many fleeing from the east of prewar Poland which had been handed to the Soviet Union. Torn from their roots, the new population ended up being more cosmopolitan and politically more centrist than their cousins in the east. Even three generations later, the echoes of that postwar migration can still be heard.

With the exception of Łódź and Warsaw — two metropolitan areas where Civic Platform won pluralities in the most recent parliamentary election — the east of Poland is on average poorer than the rest of the country. Most other urban areas are in the northwest, or former Prussia, and along the border with what are now the Czech Republic and Slovakia.

Since 2005, when Civic Platform and Law and Justice established a duopoly on power, the political map of Poland can be drawn almost perfectly along historical lines. When, in 2007, the agrarian People’s Party and the populist Self-Defense of the Republic of Poland threw their support behind Civic Platform and Law and Justice, respectively, the trend became particularly pronounced. In the last two parliamentary elections, the former has won pluralities in almost all former German areas of Poland while the latter has won almost almost all former Austrian and Russian ones.

This year’s election looks likely to follow the same pattern with the balance shifting back to the conservatives.