Get access to the best calls on Wall Street with StreetInsider.com's Ratings Insider Elite. Get your Free Trial here.

BERLIN (Reuters) - Germany plans to sharply curb EU citizens' access to welfare benefits with new draft legislation that would save local communities billions of euros, government officials said on Friday.

New legislation was required after a federal court ruled in 2015 and 2016 that non-working EU citizens had a right to social welfare benefits after six months in Germany. Before the ruling, there was no right to such benefits.

Chancellor Angela Merkel's center-right government is taking a number of steps to stem losses to the anti-immigrant Alternative for Germany party amid growing frustration about an influx of refugees and other migrants.

The new legislation would make EU citizens who are not working in Germany ineligible for social welfare or unemployment benefits until they have lived there for five years.

Officials said the change was aimed at ensuring that those who moved to Germany were actively looking for work and not simply living off benefits.

The cabinet is due to review the bill next week before it is sent to the lower house of parliament, the officials said, confirming a report published on Friday by the Funke Medien Gruppe newspaper chain.