BERLIN (Reuters) - Germany’s upper house of parliament on Friday rejected a law already approved by the lower house to classify Algeria, Morocco and Tunisia as safe countries of origin that would make it easier to deport failed asylum seekers from those states.

The law, which passed through the Bundestag lower house in May, would have allowed authorities to speed up the processing of asylum seekers from those countries and then deport them if their applications were rejected.

But it failed to win a majority in the Bundesrat, or the states’ chamber. The government or the Bundestag can now contact the mediation committee to discuss possible ways of reaching an agreement, the Bundesrat said.

Tensions in Germany are running high ahead of the Sept. 24 election after more than 1 million migrants arrived in the country over the last two years.

The Bundesrat did not give a breakdown of votes but the opposition Greens have opposed the law and for the upper house to approve it, several states in which the Greens are part of the government needed to back it.

Dieter Lauinger, Migration and Justice Minister in Thuringia state and a Greens member, said his party was against it because human rights organizations had concerns about treatment of homosexuals and political opponents being subject to repression.

Interior Minister Thomas de Maiziere said it was a “bad day for our efforts to stop illegal migration. The Greens...are to blame”.

Most migrants from these countries are already refused asylum: last year only 3.8 percent of Moroccan asylum applications were accepted compared with 0.8 percent from Tunisians and 2.7 percent from Algerians.

The Federal Office for Migration and Refugees (BAMF) said around 8,000 people form these three countries came to Germany last year - down from more than 26,000 the previous year.

Chancellor Angela Merkel’s conservatives, seeking re-election in September, have toughened their stance on migrants in recent months.

In February, Peter Altmaier, Merkel’s chief of staff, said Germany deported a record 80,000 migrants denied asylum last year and that figure will rise again in 2017.