In the end, the vote wasn't even close. Led by federal states with left-leaning governing coalitions, a wide majority the Bundesrat shot down a law written by the government and passed by Germany's lower parliamentary chamber, the Bundestag. It would have declared the Maghreb states - Tunisia, Morocco and Algeria - "safe countries of origin" and thus allowed for expedited deportations of failed asylum seekers there.

Representatives of the federal government and the conservative-led state of Bavaria argued that the law was needed to prevent people wishing to migrate to Germany for economic reasons from misusing Germany's asylum legislation. They said only a tiny fraction of asylum applications by people from the three Maghreb states have been approved.

"Filing hopeless applications for political asylum should not be a way of getting around the normal paths of immigration to our labor market," Bavarian Interior Minister Joachim Herrmann said. "As a rule, someone from Tunisia, Algeria or Morocco has no right to asylum, but we want only those people to stay in Germany who truly are persecuted."

But Dieter Lauinger of Thuringia, which is governed by the Left Party, the Social Democrats and the Greens, countered that such poor prospects for approval alone didn't mean that Tunisia, Morocco and Algeria should be considered safe. He added that the number of asylum applications from those countries had dwindled to very low levels - 268 in February 2017.

Conservatives were out-voted in the Bundesrat

He also said a major obstacle to deporting rejected asylum-seekers was that their home countries refused to take them back.

"The problem isn't with the numbers but deporting people back to these countries," said Lauinger, a member of the Greens. "So declaring them safe countries won't do any good."

A rejection long in the making

The government formulated the law in early 2016 in the wake of highly publicized cases of sexual molestation of woman by young men of North African origin on New Year's Eve in Cologne. Proponents of the legislation cited those events in their last-ditch efforts to get the Bundesrat to pass it.

"Never before had it come to mass rapes in our public spaces," governmental parliamentary state secretary Ole Schröder said. "Partly young men from the Maghreb states, some with criminal records, abused our asylum laws."

Schröder added that only 2.8 percent of asylum applications by people from the Maghreb countries were granted last year.

Countries like Morocco often refuse to take people back

But while the Bundestag, which represents voters nationally and where Merkel's grand coalition government enjoys a large majority, quickly approved the law in May 2016, the Greens and the Left Party used their influence to stall and ultimately torpedo it in the Bundesrat.

"It is absurd to try to declare that Tunisia, Algeria and Morocco are safe countries of origin," Left Party domestic affairs spokeswoman Ulla Jelpke said ahead of the Bundesrat's vote. "Grave human rights violations, political persecution, extra-legal killings and torture are common in Morocco and Algeria. Tunisia is ruled by a regime that has declared a permanent state of emergency. And gays and lesbians are persecuted in all three countries."

The Bundesrat is made up of representatives of Germany's 16 federal states. Its approval of the law was required because the states, and not the German national government, are responsible for carrying out deportations.

Advocacy groups celebrate victory

The law is now dead, but the issue is certain to resurface throughout campaigning for Germany's national election in September. The conservative-led government was quick to accuse the left-wing parties of obstructionism.

"This is a bad day for our efforts to stop illegal immigration," conservative German Interior Minister Thomas de Maiziere said. "And the Greens, especially at the national level, bear the responsibility."

The Maghreb safe states law was very controversial

Gay and lesbian organizations as well as refugee organizations, including Pro Asyl and Amnesty International Germany, welcomed the decision. Pro Asyl pointed out that only around 8,900 applications for asylum were made by people from the Maghreb states in 2016 - a little more than 1 percent of the total applications in Germany. The advocacy group also argued that classifying the trio of nations as safe would be unconstitutional.

"Neither the human rights situation in these countries nor the criteria of the Federal Constitutional Court permit this classification," Pro Asyl Director Günter Burkhardt said.

Amnesty International rejected the whole idea of nations being safe for deportation.

"The concept of 'safe countries of origin' is fundamentally incompatible with the basic human right to asylum," said Amnesty International in Germany asylum law expert Wiebke Judith. "One of the federal republic's duties, vis-à-vis human rights, is to guarantee every applicant fair and unbiased asylum proceedings."