BERLIN — A new political force is shaking up Germany: Its leaders campaign in Bavarian beer tents wearing traditional dirndls and tour the country quoting the national anthem. One member recently wrote a book about patriotism, another about “new conservatism.” One of its biggest issues is immigration.

Last month, it dealt Chancellor Angela Merkel such a blow at the ballot box — twice — that she announced her retreat.

No, it is not the far right. It is a re-energized left.

In recent years, the political energy has seemed to come almost exclusively from the right. But while the rise of the nationalist Alternative for Germany, or AfD, has gotten the most attention, the liberal, pro-refugee Greens party has quietly expanded its following.

Once an environmental protest movement, the Greens party is now the second-most popular party in the country, lagging behind the conservatives by only a few percentage points, polls show. Among women, it is already No. 1.