When I was growing up, my father used to tell me stories of his travels to Poland.

“It was a rite of passage for Hungarian youth,” he said. “Once we got to Poland we would hitchhike around and stay with locals; we’d just need to hold out a small Hungarian flag on the side of the road and we’d be picked up.”

“Why did the flag help?” I asked once.

“The two countries have always been friendly, there’s even an old proverb about it: ‘Lengyel, magyar két jó barát, együtt harcol s issza borát.’ In English, it means ‘Hungarians and Poles are two brothers, they fight together and they drink together’,” my father replied.

Although I had heard tales like this all my life, it still came as a surprise when I learned that the friendship between the people of Hungary and Poland is no small matter. In fact, it’s so remarkable that it is celebrated with an official holiday.

In 2007, the respective parliaments of both countries declared 23 March as ‘The Day of Polish-Hungarian Friendship’ by unanimous decree. I found it both endearing and unusual that, in a world of global tensions and conflict, two countries that do not even share a border would set aside a day solely to appreciate their camaraderie.

Curious to learn what makes the bond between these countries so special, I sought out Professor Gábor Lagzi, a historian and Polonist at the University of Pannonia in Veszprém, Hungary.

“The friendship between Hungary and Poland is a phenomenon,” Lagzi explained. “It is like two oak trees that grow separately, but their roots are fused, grown together in the soil. We are connected by nearly 1,000 years of intense political, economic, and cultural relations.”

The precise beginnings of the connection are difficult to identify, but Lagzi notes a history of shared monarchs from the Middle Ages as a significant factor.

In the 14th Century, the Hungarian king Louis the Great inherited the Polish throne after his maternal uncle, the Polish king Casimir III, died without an heir. Louis the Great ruled both countries separately at different points in his life. After his death, his daughter Jadwiga became the first queen of Poland, and remains a respected figure to this day.

In 1576, another Hungarian held the Polish throne – this time by choice – when the people of Poland elected Transylvanian prince István Bathóry as their ruler.

But royalty wasn’t all the two countries shared.

“One of the peaks of Polish-Hungarian friendship came in the Spring of Nations in 1848,” Lagzi explained. “Almost everyone has heard of the liberation hero Józef Bem, a Polish general who fought bravely alongside the Hungarians in the struggle for independence from the Austrian Empire. In Hungary, we often call him Bem Apó, which is a term of endearment meaning something like ‘Grandpa Bem’.”

Having fought in both the Polish uprisings against the Russian Empire in 1830 and in the Hungarian uprising against the Austrian Empire in 1848, Bem became regarded as a national hero in both countries, even though he was Polish in origin. According to Lagzi, the slogan ‘For our freedom and yours’ caught on in Poland at this time, reflecting the fact that many Polish war heroes travelled to take part in liberation struggles across the globe.

Though an intertwined group of monarchs and national heroes certainly strengthened the relationship between Hungary and Poland, it’s true that ties between countries were often solidified through marriage in the Middle Ages, and it wasn’t unheard of for allied countries to be joined in battles.

I asked Lagzi what exactly makes the Hungarian-Polish relationship different from any other alliance. He pointed to World War II, a time when the friendship endured despite the two countries finding themselves on opposing sides: Hungary affiliated with the Axis and Poland on the side of the Allies.

“One of the most beautiful moments in our relationship was the acceptance of more than 100,000 Polish refugees after their country’s collapse in 1939. At that time, Hungary was in an alliance with Germany, remember, but it still proved to be a safe haven for Polish refugees.”

“Weren’t there any consequences for accepting the refugees?” I asked.

“The German authorities, mainly the German embassy workers in Budapest, were not happy,” Lagzi replied. “Still, many Polish refugees remained safe until the German occupation of Hungary. All Hungarian people, from aristocrats to commoners, felt a lot of sympathy for the Polish people.”

All Hungarian people, from aristocrats to commoners, felt a lot of sympathy for the Polish people.”

Though Hungary did order some deportations in the earlier years of the war, the situation did not escalate until after potential armistice discussions between Hungary and the Allies took place in 1944. Seeing the discussions as a betrayal, German forces began an aggressive occupation of the country in retaliation, and soon both Poles and Hungarians – specifically the Jewish and the Roma populations – faced execution or deportation to concentration camps.

After World War II ended, however, the people of Poland did not have long to wait before they could return the favour, according to Lagzi.

In 1956, protesters in Budapest gathered around a statue of none other than Bem to speak out against the domineering influence of the Soviet Union. The result was the Hungarian Revolution of 1956, a bloody conflict that eventually led to a crushing defeat of the Hungarian rebels. The people of Poland quickly stepped in to provide aid to the beleaguered Hungarians. They sent munitions and supplies, and thousands of Polish citizens donated blood for the wounded. The gesture had such a profound and lasting impact that Hungarian parliament declared 2016 as the year of Hungarian-Polish Solidarity to commemorate the 60-year anniversary of the uprising.

But Lagzi was clear that these government declarations are not merely a whim of the political elite, but largely reflect the will and spirit of the greater population.

“The Hungarian and Polish parliaments declared 23 March the day of friendship without any votes opposed or abstentions,” he said, stressing that this was a highly unusual occurrence considering that there are usually deep political divides between Hungary and Poland’s political parties.

“A unanimous vote showed us that the Hungarian-Polish relationship is outside of, or even above, political agendas. It united the entire political elite in both countries.”

Now, Polish-Hungarian Friendship Day is celebrated annually, with the main festivities taking place in the sister cities of Győr (Hungary) in even years and Poznań (Poland) in odd years. It is an occasion for major politicians of the two countries to gather together, and festivities often include theatrical productions, film screenings and art exhibitions, all centred around the strong bond between the two nations.

But even with this new, more comprehensive understanding of the historical ties between the two countries, I felt that there was something missing from the equation, some unquantifiable factor that remained elusive.

Lagzi understood the sentiment all too well, admitting that the friendship did seem strange, especially from an outside perspective.

“We can look at the history for an explanation, but really I think it is something that cannot be explained logically. Somehow, we Hungarians just inherently love the Poles, and vice versa,” he said.

Why We Are What We Are

“The truth is,” he added, “that if asked about the relationship, almost every person in Poland and Hungary would say, ‘we are friends forever’.”

Why We Are What We Are is a BBC Travel series examining the characteristics of a country and investigating whether they are true.

If you liked this story, sign up for the weekly bbc.com features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.