MADRID (AP) — Spanish Prime Minister Mariano Rajoy said Friday he would be prepared to seek an alliance with politicians outside his Popular Party to prevent a leftist coalition government emerging after this weekend's general election.

Opinion polls suggest that no party will win a majority Sunday, likely leaving four main parties looking to forge pacts and form a government. Polls suggest Rajoy's Popular Party will win the most seats in the 350-deputy Parliament but lose its current 186-seat majority.

Rajoy had previously declined to discuss possible alliances but told Cope radio Friday he would seek help to prevent a coalition of the two main leftist parties or one comprising eight or more mostly leftist groups, which he said would be bad for Spain.

Campaigning ends at midnight Friday with the country's 36.5 million voters having a day to reflect on whom to vote for.

The Popular Party and the Socialists have basically alternated in office for more than three decades and the Dec. 20 election is seen as the first time other parties are posing a serious challenge.

Rajoy's hopes his government's achievement of returning the economy to growth after back-to-back recessions during the 2008-2013 crisis period will help stem ratings plunge.

But 21 percent unemployment and Spaniards' disenchantment with the two main parties' handling of the crisis, as well as their perceived involvement in myriad corruption cases, has given rise to two new parties, the center-right Ciudadanos and the far-left Podemos party.

A trusted government-run poll released before the campaign start Dec. 4 suggested Rajoy's party could win up to 128 seats against 89 for the leading opposition Socialists. Ciudadanos could gain 66 seats and Podemos, 25.

After the voting, King Felipe VI will consult with each party and call on one — not necessarily the one with the most votes — to try to form a government.