Barack Obama has tried his best to largely steer clear of politics and adhere to the convention of giving new President’s some leeway in the early period of the administration but it appears it has now become too much for him.

The former President, who has kept a relatively low profile since leaving the White House in January, has taken a direct swipe at Donald Trump during a trip to Jakarta in Indonesia on Saturday.

Mr Obama, who spent several years in Indonesia as a child, took President Trump to task for pulling out of the Paris Agreement on climate change and suggested America was currently devoid of leadership.

Touting one of his cornerstone achievements while in office, he said: "In Paris, we came together around the most ambitious agreement in history about climate change.”

“An agreement that even with the temporary absence of American leadership, can still give our children a fighting chance”.

Last month, President Trump shocked the world when he announced he would be withdrawing the US from the landmark Paris climate deal. The decision was instantly condemned by world leaders, US politicians and environmental groups, who labelled it an “international disgrace”.

Mr Obama, whose administration played a key role in negotiating the deal, responded by accusing President Trump of actively rebuffing the future. At the time, he said: “This administration joins a small handful of nations that reject the future”.

Thousands march against Donald Trump in LGBT rights parade Show all 8 1 /8 Thousands march against Donald Trump in LGBT rights parade Thousands march against Donald Trump in LGBT rights parade A marcher hold a sign that reads "Love is Love is Love" on the National Mall with the Washington Monument in the background during the Equality March for Unity and Pride in Washington AP Thousands march against Donald Trump in LGBT rights parade Marchers unfurl a huge rainbow flag as they prepare to march in the Equality March for Unity and Pride in Washington AP Thousands march against Donald Trump in LGBT rights parade Marchers gather to hear speakers at the end of the Los Angeles LGBTQ #ResistMarch AP Thousands march against Donald Trump in LGBT rights parade Gil Mendez, of San Francisco, holds a sign to honor the victims of the shooting at the Pulse Nightclub in Orlando as he marches during the Equality March for Unity and Pride in Washington AP Thousands march against Donald Trump in LGBT rights parade An demonstrator looks on as LGBT members and their supporters take part of the Equality March for Unity AFP/Getty Images Thousands march against Donald Trump in LGBT rights parade A marcher listens to speakers at the end of the Los Angeles LGBTQ #ResistMarch AP Thousands march against Donald Trump in LGBT rights parade LGBT members and their supporters take part of the Equality March for Unity AFP/Getty Images Thousands march against Donald Trump in LGBT rights parade A marcher mugs for the camera during the Los Angeles LGBTQ #ResistMarch AP

During his trip to the Indonesian capital Mr Obama was greeted by a crowd of thousands, including leaders, students and businesspeople as he opened the Fourth Congress of Indonesian Diaspora.

The former President also used his appearance to emphasise the importance of moving away from news sources where only like-minded, compatible views are disseminated and warned social media was prompting mounting resentment of minorities.

He also emphasised the importance of not become obsessed with the daily news cycle, saying: "I wasn't worried about what was in the newspapers today. What I was worried about was, 'What are they going to write about me 20 years from now when I look back?'"

Mr Obama had a years-long feud and fraught relationship with his successor Mr Trump for many years. During his 2008 presidential campaign and throughout his presidency, multiple theories emerged falsely claiming he was not a natural-born American US citizen and it was therefore unconstitutional for him to become US President. Mr Trump was among those who pushed the “birther” conspiracy theory and consistently questioned former President Obama’s birthplace of Hawaii.