Germans in a southwestern state voted Sunday in favour of building a 4.5-billion euro train station in Stuttgart, ending a controversy over the giant project that helped to push Chancellor Angela Merkel's party out of power in the state.

Voters in Baden-Wuerttemberg backed by a 59-41 percent margin the Stuttgart 21 station that will be part of a high-speed rail network linking southern Germany, France and Austria. About 48 percent of eligible state voters took part in the referendum, a rarity in Germany.

Construction of the station in Stuttgart, the capital of Baden-Wuerttemberg, had been halted after violent protests a year ago. Thousands of demonstrators tried to stop the project, reflecting a wider outcry against politicians in general.

The state government will accept the will of the people, said state premier Winfried Kretschmann, whose opposition to the new station helped his Greens party to win control of a German state for the first time last March.

I'm a bit surprised by the result, he added. It's a hard decision. But it's a good day for democracy that so many people took part in the referendum. We want to use this form of consulting the public more often in the future.

Kretschmann's Greens had opposed the station while the Social Democrats (SPD), his junior coalition partners in the state, had supported it.

The Greens swept Merkel's Christian Democrats from power in Baden-Wuerttemberg in March, helped by anti-nuclear sentiment following the accident at Japan's Fukushima complex and by disaffected voters who believed the Stuttgart station was too expensive and planned without enough public consultation.

The new centre-left state government agreed to the first referendum in the state in more than 40 years to resolve the impasse.

City, state and local officials spent 15 years working on the station project. They say it will cut down on travel times and open up a vast tract of inner city land to developers.

(Reporting by Hendrik Sackmann in Stuttgart; editing by David Stamp)