President Barack Obama delivers a statement on the Paris Agreement in the Rose Garden of the White House in Washington, October 5, 2016.

America must work with all nations to build stronger economies, recognizing the inequalities that globalization can generate but refusing to give in to protectionism, U.S. President Barack Obama wrote in the Economist on Thursday.

Months before he leaves the White House in January, Obama wrote that a certain anxiety over globalization had taken hold in the United States, not unlike the discontent leading to Britain's vote in June to leave the European Union.



"The world is more prosperous than ever before and yet our societies are marked by uncertainty and unease," the Democratic president wrote.



"So we have a choice - retreat into old, closed-off economies or press forward, acknowledging the inequality that can come with globalization while committing ourselves to making the global economy work better for all people, not just those at the top."



Calling capitalism the greatest driver of prosperity the world has ever known, Obama argued that trade had helped the U.S. economy much more than hurt it.