US President Donald Trump and first lady Melania Trump react during delivering a speech to Japanese and US troops as they aboard Japan Maritime Self-Defense Force's (JMSDF) helicopter carrier DDH-184 Kaga at JMSDF Yokosuka base in Yokosuka, south of Tokyo. Picture: Athit Perawongmetha/Pool Photo vi AP
US President Donald Trump and first lady Melania Trump react during delivering a speech to Japanese and US troops as they aboard Japan Maritime Self-Defense Force's (JMSDF) helicopter carrier DDH-184 Kaga at JMSDF Yokosuka base in Yokosuka, south of Tokyo. Picture: Athit Perawongmetha/Pool Photo vi AP
Japan's Prime Minister Shinzo Abe delivers a speech to Japanese and U.S. troops with U.S. President Donald Trump as they aboard Japan Maritime Self-Defense Force's (JMSDF) helicopter carrier DDH-184 Kaga at JMSDF Yokosuka base in Yokosuka. Picture: Athit Perawongmetha/Pool Photo vi AP
Japan's Prime Minister Shinzo Abe delivers a speech to Japanese and U.S. troops with U.S. President Donald Trump as they aboard Japan Maritime Self-Defense Force's (JMSDF) helicopter carrier DDH-184 Kaga at JMSDF Yokosuka base in Yokosuka. Picture: Athit Perawongmetha/Pool Photo vi AP
President Donald Trump greets troops after speaking at a Memorial Day event aboard the USS Wasp in Yokosuka, Japan. Picture: Evan Vucci/AP
President Donald Trump greets troops after speaking at a Memorial Day event aboard the USS Wasp in Yokosuka, Japan. Picture: Evan Vucci/AP
President Donald Trump and first lady Melania Trump walk to board Air Force One as they depart Haneda International Airport in Tokyo. Picture: Evan Vucci/AP
President Donald Trump and first lady Melania Trump walk to board Air Force One as they depart Haneda International Airport in Tokyo. Picture: Evan Vucci/AP
President Donald Trump speaks to troops at a Memorial Day event aboard the USS Wasp in Yokosuka, Japan. Picture: Evan Vucci/AP
President Donald Trump speaks to troops at a Memorial Day event aboard the USS Wasp in Yokosuka, Japan. Picture: Evan Vucci/AP
A service member wears a patch that says "Make Aircrew Great Again" as they listen to President Donald Trump speak to troops at a Memorial Day event aboard the USS Wasp in Yokosuka, Japan. The patch includes a likeness of Trump. Picture: Evan Vucci/AP
A service member wears a patch that says "Make Aircrew Great Again" as they listen to President Donald Trump speak to troops at a Memorial Day event aboard the USS Wasp in Yokosuka, Japan. The patch includes a likeness of Trump. Picture: Evan Vucci/AP
US President Donald Trump, centre left, first lady Melania Trump, left, Japan's Prime Minister Shinzo Abe and his wife Akie Abe wave after delivering a speech to Japanese and US troops as they aboard Japan Maritime Self-Defense Force's (JMSDF) helicopter carrier DDH-184 Kaga at JMSDF Yokosuka base in Yokosuka, south of Tokyo. Picture: Athit Perawongmetha/Pool Photo via AP
US President Donald Trump, centre left, first lady Melania Trump, left, Japan's Prime Minister Shinzo Abe and his wife Akie Abe wave after delivering a speech to Japanese and US troops as they aboard Japan Maritime Self-Defense Force's (JMSDF) helicopter carrier DDH-184 Kaga at JMSDF Yokosuka base in Yokosuka, south of Tokyo. Picture: Athit Perawongmetha/Pool Photo via AP

Tokyo - US President Donald Trump addressed around 800 troops at a US naval base in Japan on Tuesday before ending his four-day state visit to the country.

"I'm thrilled to be aboard USS Wasp with brave sailors and marines," Trump said aboard the amphibious assault ship, docked at the US Yokosuka Naval Base, south of Tokyo.

"On this Memorial Day evening in the United States, Americans are concluding a sacred day of remembrance, reflection and prayer," Trump said.

"Our republic endures because of brave men and women who are willing to lay down their lives to defend us all," the president said.

"Our freedom is earned through the blood and sweat and toil and sacrifice of great American patriots just like you," he added.

Earlier in the day, Trump, joined by Japanese Prime Minister Shinzo Abe, boarded Japan's helicopter carrier Kaga docked at a Japanese base also in Yokosuka.

"Our mission is to realize a free and open Indo-Pacific and to establish a foundation for regional peace and prosperity," Abe said in an address to 500 US and Japanese troops.

In the morning, Trump and his wife, Melania, received a last visit at their hotel from Emperor Naruhito and Empress Masako.

The emperor told the couple that he was very happy to have been able to host them, Kyodo News agency reported, citing palace officials.

Trump expressed his gratitude for a state banquet at the Imperial Palace on Monday evening, hosted by the emperor and the empress, emphasizing how he now considers them personal friends, the report said.

Trump became the first head of state on Monday to meet the new emperor since he ascended to the Chrysanthemum Throne on May 1.

As Japan rolled out the red carpet for Trump, the president, who has been threatening to slap tariffs on Japanese cars and car parts, has toned down his criticism of the Asian country's chronic trade deficit with the US.

Trump and the first lady departed from Tokyo's Haneda Airport after 1 pm (0400 GMT).

"Meetings with Prime Minister Abe went very well, and getting to spend time with the new Emperor and Empress of Japan was a great honor!" Trump tweeted.

dpa