President Barack Obama has achieved a first for any of the previous heads of state.

The President of the United States made a rare appearance on Zach Galifianakis's hilarious web series show 'Between Two Ferns', which streams on the website Funny or Die.

Galifianakis, who is known for his role as Alan in 'The Hangover' franchise, acts as the host of the semi-fake talk-show, and this Tuesday's episode saw his biggest guest to date.

Although 'Between Two Ferns' usually mocks its former guests, Obama's appearance did have some meaning, he wanted to encourage young Americans to sign up for health insurance.

But as Galifianakis brought his usual awkward, unprepared and inappropriate interview style, the short segment proved to be a hilarious clip, and shows a refreshing side to the President.

Obama started the interview by declaring, "When I heard that people actually watch this show, I was actually pretty surprised."

It didn't take long before the pair started exchanging insults back and forth in the first part of the clip.

"What is it like to be the last black president?" Galifianakis smugly replied. "What's it like for this to be the last time you ever talk to a president?" Mr Obama fired back.

"It must kind of stink, though, that you can't run three times?" the Hollywood star continued.

Mr Obama added, "If I ran a third time it would be like doing a third Hangover movie. It didn't really work out very well, did it?"

Zach Galifianakis
Zach Galifianakis traded hilarious insults with the President

The incredibly funny exchange last for nearly three and-a-half minutes, until the President stated the purpose for his appearance on the cult show, as he asked the host, "Have you heard of healthcare.gov?"

Galifianakis smeared quietly, "here we go", before replying, "OK, let's get this out of the way, what did you come here to plug?"

Mr Obama then went onto explain the benefits of the US's healthcare system, urging young American's to get covered before the deadline on March 31st.

The interview concluded with the President hitting a panic button which caused the usual black back set to fall and revealed the was shot in what looks like to be a room in the White House.

"Thanks for the interview, and thanks for letting me shoot my show here after all these years," Zach said, claiming former President George Bush gave him permission to use the Diplomatic Room.

Watch President Barack Obama's appearance on 'Between Two Ferns' below
)