Yui Mok/Press Association via AP
The Prince of Wales met members of the Polish military during a visit to the 3rd Brigade Territorial Defense Force base in Rzeszów, Poland on Wednesday, March 22.
Warsaw, Poland CNN  — 

Britain’s Prince William made a rare, unannounced trip to Poland on Wednesday, meeting British and Polish troops stationed near the Ukrainian-Polish border and praising their “cooperation in support of the people of Ukraine and their freedom.”

The Prince of Wales first visited the 3rd Brigade Territorial Defense Force base in Rzeszów, where he met Polish Defense Minister Mariusz Blaszczak and viewed a display of military equipment.

While there, he spoke to British and Polish soldiers about the robust comradeship that has formed since they started working together.

The 40-year-old royal then met members of the British Armed Forces to learn more about how they have been collaborating with their Polish counterparts delivering operations in support of Ukraine.

Landing in the Polish capital of Warsaw, William said in a statement that it was “fantastic” to be back in Poland.

“Our nations have strong ties. Through our cooperation in support of the people of Ukraine and their freedom, which are also our freedoms and yours, these ties are further strengthened,” the heir to the British throne said.

Yui Mok/Press Association via AP
Prince William greeted members of the British military during the visit.

“I’m here because I want to personally thank the Polish and British troops working in close and crucial partnership. I also want to pay tribute to the inspiring humanity of the Polish people. You have opened your hearts as much as your homes,” he continued.

“That’s why this afternoon I visited Rzeszów to hear their stories and recognize their duty. I was struck by their passion as well as their shared determination to defend our shared freedoms,” William added.

This is William’s first trip to Poland since a 2017 visit with his wife, Catherine, Princess of Wales, and the prince is also eager to gain a stronger understanding of how the country has shown compassion to its Ukrainian neighbors.

Following the surprise troop visit, William traveled to Warsaw where he visited an accommodation center, “to see the humanitarian response first-hand and just how vital the support is that communities across Poland are providing to Ukrainians fleeing the war.”

Yui Mok/Press Association via AP
Prince William and Polish Deputy Prime Minister and Minister of Defence Mariusz Blaszczak (center left) pose for a group photo with British and Polish troops.

Described by Kensington Palace as being “at the frontline of the humanitarian crisis,” the facility is providing lodgings for around 300 women and children who have recently arrived in the country and are not yet integrated into local communities.

The former office building turned accommodation center is operated by the City of Warsaw and opened shortly after Russian forces flooded over Ukraine’s borders in an unprovoked invasion.

More than 8 million Ukrainians have fled to neighboring countries since the start of the war. At least 1.5 million Ukrainian refugees remain in Poland, according to government estimates.

Ukrainian refugees are provided with two meals a day, while a variety of resources – including Polish language classes, employment and psychological support and a children’s play area – are available.

The royal was met by the city’s mayor and spoke with some of the displaced Ukrainians living at the center, learning more about how they came to move to Poland.

Czarek Sokolowski/AP
Prince William, center, and Mayor of Warsaw Rafal Trzaskowski, left, talk to an Ukrainian woman, who fled the war, during their visit to an accommodation centre in Warsaw, Poland on Wednesday evening.

He also met with volunteers who have been helping people displaced by the conflict to find out how they have been managing and distributing donations from the community, which are dispensed through a “free shop.”

William’s previously unannounced trip to Poland will be a short excursion. On Thursday, he will lay a wreath at the Tomb of the Unknown Soldier – a monument for fallen soldiers in Piłsudski Square in the heart of the Polish capital. Nearly 27 years earlier, in 1996, Queen Elizabeth II and Prince Philip laid a wreath at the war memorial while in the country for a state visit.

After leaving the tomb, William is due at the Presidential Palace for a meeting with Polish leader Andrzej Duda, during which he will “reiterate the profound relationship shared by our two nations and underline my continued support and gratitude to the Polish people.”

He’ll round out the whistlestop visit by heading over to a local food hall, where he will meet young Ukrainians who will share their experiences of resettling in Poland after being displaced by the war. They are expected to discuss how they restarted their studies and found employment in Warsaw. The prince will also speak with host families who have helped accommodate Ukrainian refugees and express his gratitude to them and their families for opening their homes and for their compassion.

The royal family has been unusually forthright about the war over the past year, offering its support to Ukraine on numerous occasions.

Unlike his mother, who avoided direct remarks on political matters throughout her reign, King Charles III has been much more plainspoken on the subject of Ukraine.

“The world has watched in horror at all the unnecessary suffering inflicted upon Ukrainians, ” the King said last month, in a message marking a year since the Russian invasion. “I can only hope the outpouring of solidarity from across the globe may bring not only practical aid, but also strength from the knowledge that, together, we stand united.”

Charles had previously reaffirmed his support directly to Ukrainian President Volodymyr Zelensky when the two met at Buckingham Palace in early February. Along with the Queen Consort, he has also incorporated engagements with the Ukrainian community in the UK into his diary, as have William and Kate.

Sign up for CNN’s Royal News, a weekly dispatch bringing you the inside track on the royal family, what they are up to in public and what’s happening behind palace walls.