Dutch King Willem-Alexander has offered an apology over "excessive violence" suffered by Indonesians during the early years of Indonesian independence, acknowledging the period as a "painful separation".

The statement was conveyed by the king after he and Queen Maxima were hosted by President Joko "Jokowi" Widodo in an official ceremony at the Bogor Palace in West Java on Tuesday.

"In line with earlier statements by my government, I would like to express my regret and apologies for the excessive violence on the part of the Dutch in those years," Willem said during a joint press statement on Tuesday.

"And I do so in the full realization that the pain and sorrow of the families affected continue to be felt today."

Willem's statement reversed previous Dutch monarchs’ stance of refusing to apologize for the nation’s past war crimes in the country. During the last state visit by a Dutch monarch in 1995, Queen Beatrix was prevented by then-prime minister Wim Kok from offering an apology, saying the Netherlands was not ready.

Indonesia declared independence on Aug. 17, 1945, but the Dutch only recognized its sovereignty on Dec. 27, 1949.

The Dutch government had apologized several times for its colonial troops’ war crimes conducted between 1945 and 1949 in Indonesia.

In 2013, then-Dutch ambassador to Indonesia Tjeerd de Zwaan addressed an apology to 10 widows of men who were summarily executed in a series of mass killings in South Sulawesi between December 1946 and February 1947 during military operations by Dutch troops under Raymond Pierre Paul Westerling.

The king’s four-day state visit kicked off on Tuesday. It went ahead despite the recent announcement of 19 confirmed COVID-19 cases in Indonesia.

The Dutch king also expressed his desire to see a stronger tie between Indonesia and the Netherlands.

"Indonesia has a long tradition of religious tolerance and can play a constructive part in this respect. It's important to continue working together to foster peace, justice and the protection of minorities based on respect for sovereignty and territorial integrity," King Willem-Alexander said.

"And we are keen to work together with you toward this end."

Speaking before Willem, Jokowi emphasized the need for the two countries to forge ahead in a relationship of mutual respect.

"Of course, we cannot erase the history, but we can learn from the past. It serves as a lesson for our commitment to grow a relationship that is equal and with mutual respect and mutually-beneficial," the President said.