BEIJING — China’s vow to shut down its commercial ivory trade by the end of this year was welcomed by environmentalists as a turning point in the fight against poachers. Activists cheered the government’s pledge for swift action, and the state-run news media called it a “monumental win for elephants.”

But in making the decision, announced on Friday, to bring the world’s largest ivory market to a halt, the Chinese government also saw benefits for itself. The ban reinforced President Xi Jinping’s campaign against corrupt officials, who have been known to use ivory products as bribes.

It galvanized support among African allies, which have long pressed Beijing to help curb poaching, as China looks to expand its influence on the continent.

And the decision allowed China to burnish its image as a global guardian of the environment, at a time when advocates have raised doubts about the ability of the United States to lead on environmental issues.