Many of Ms. Merkel’s decisions have garnered as much criticism as praise. Her insistence on austerity when Greece was on the ropes was widely denounced as excessive. The opening of Germany’s border to refugees has been blamed for the rise of the right-wing Alternative for Germany party and the decline of Ms. Merkel’s popularity, which was on display in the poor showing by her Christian Democrats in Hesse state elections on Sunday. Yet Ms. Merkel’s principled action, so different from the nativist opposition to immigrants trumpeted by European populists and Mr. Trump, also exemplifies the moral precepts, forged growing up in a Lutheran home in East Germany, that are behind Ms. Merkel’s instincts and style. Her typically understated plea to Germans during the refugee crisis was simply, “Wir schaffen das” — We’ll manage it.That’s what Ms. Merkel, now 64, has done for 13 years, listening more to the “inner compass” of her Lutheran faith rather than any ideology, against which she was inoculated by her years behind the Iron Curtain; preferring blandness and ambiguity to stridency, caution to expediency. “I’m a bit liberal, a bit Christian-social, a bit conservative,” she said in 2009, an approach she demonstrated in her handling of gay marriage last year, when she allowed a vote on the issue in the Bundestag while joining the minority in voting “no.”In foreign affairs, Ms. Merkel has been a strong champion of the European Union, NATO and protecting a rules-based international order. Under her, Germany has increased its role in international security, and Ms. Merkel has made a commitment to raising military spending to 2 percent of gross domestic product. A Pew Research Center survey of 25 countries found that 52 percent of respondents had confidence in Ms. Merkel, more than the leaders of France, Russia, China and the United States. (Seventy percent lacked confidence in Mr. Trump.)That’s a tough act for Ms. Merkel’s successor to follow, and major challenges lie ahead: reshaping a European Union without Britain, strengthening institutions that govern the euro, clashes with the Trump administration and neighboring populists, dealing with Russia.But Ms. Merkel is doing the right thing in stepping down. “I don’t want to be a half-dead wreck when I leave politics,” she said before she became chancellor, and of late she and her coalition have looked tired. Her polls have fallen, and 13-plus years are more than enough for any political leader. And the best leaders are those who know when it’s time to exit.Follow The New York Times Opinion section on Facebook, Twitter (@NYTopinion) and Instagram.