After data showed that rising numbers of migrants from Algeria, Morocco and Tunisia were arriving in Germany last year at the peak of its record refugee influx, Berlin sought to find ways to dissuade Maghreb nationals from coming.
The move gained broad support particularly after the rash of sexual violence on New Year's Eve in Cologne that was mainly blamed on North African men.
Conferring the status of "safe countries" would mean that nationals from these countries would have little chance of winning asylum.
But the Greens rejected the measure, arguing that the human rights situation in the three countries was poor, with gays discriminated against and bloggers and journalists facing censorship.
Without the support of the Greens, the measure could not win approval in the upper house.
"We will try to hold new discussions on the subject in the coming days," said Reiner Haseloff, member of Chancellor Angela Merkel's Christian Democratic Union.
Around 26,000 migrants from the Maghreb arrived in Germany last year, and only a very small number have won asylum.
But expelling those who failed to secure asylum is also a headache for German authorities as few carry authentic identification documents, and the concerned nations are reluctant to take them back.
Germany last year opened its doors to 1.1 million asylum seekers, sparking a backlash and forcing Berlin to take steps to reduce arrivals.