On our way to Sarajevo's Ashkenazi Synagogue for the Friday evening Shabbat (Sabbath) service, my friend Paula Goldman and I walked down cobblestone streets through the Baščaršija, the old Ottoman area of the city, passing mosques, shops and a madrasa (Islamic school). It was the year 2000, and the capital of Bosnia and Herzegovina still bore the scars of the Balkans War. A Nato tank rolled by as we crossed the Miljacka river.

As we entered the second floor of the salmon-coloured stone building with its four onion-shaped domes, light flooded through doors set with stained glass images of the Star of David and into the synagogue. We took our seats among the congregation as cantor David Kamhi took his place in front of the ark that held the Torah (a scroll containing the Five Books of Moses). Soon, the synagogue filled with the harmonies of prayer. Paula and I looked at each other strangely when we heard ‘Adonaj es mi pastor. No mankare de nada’ (The Lord is my shepherd. I shall not want) from Psalm 23 recited in what we thought was Spanish. After the service, I asked Blanka Kamhi, the cantor’s wife, why the congregation was praying in Spanish.

“That wasn’t Spanish,” she responded. “We were praying in Ladino.”

You may also be interested in:

• America’s nearly forgotten language

• Where people speak the Aztec language

• A language only three women can speak

Like many Bosnian Jews, Kamhi and his wife are descendants of the Sephardic Jews who were expelled from Spain by the Edict of Expulsion in 1492. During the Spanish Inquisition, Jews who did not voluntarily convert to Catholicism were expelled from the country, killed or forcibly converted. Sultan Bayezid II of the Ottoman Empire invited the displaced Sephardic Jews to settle in the Balkans, where they were permitted to maintain their religion and customs. Many chose to move to the Ottoman Empire, while others moved to North Africa, the Netherlands and the Americas.

When the Jews left Spain, they took their language with them. Over the last 500 years, the language has maintained the structure of medieval Spanish and sounds more similar to some forms of Latin American Spanish than European Spanish. “We could not have contact with Spain and the Spanish language, and therefore we have a special language that we speak,” Kamhi said.

Today, the language is known by a number of different names: Ladino, Judeo-Spanish, Judezmo, Spanyolit, Djidió (in Bosnia and Herzegovina) and Haketia (in North Africa). And, according to Unesco, it is one of the world’s 6,000 languages that are at risk of extinction.

Before World War Two, Sarajevo’s Jewish population numbered around 12,000, and the people even printed their own newspaper in Ladino. After the Holocaust, only about 2,500 Jews returned to Sarajevo, with many of them restricting their use of Ladino to the home so as not to stand out. Since the post-World War Two Jewish community in Sarajevo was so small, the Sephardic Jews had to share a synagogue – the one where Kamhi led services until 2017 – with the Ashkenazi Jewish community, whose ancestors had relocated to Slavic countries from Germany and France following the Crusades. Because the Ashkenazi Jews primarily spoke Yiddish, the blended community relied on the Serbo-Croatian language to communicate, limiting the use of Ladino even further.

The continued use of this 500-year-old language fascinated me since I was a polyglot and spoke fluent Spanish. When I lived in Sarajevo in in the early 2000s, where I was working on post-war economic development projects, I often went to the Jewish community centre at the synagogue around lunchtime to meet the few remaining Ladino speakers and learn about their history as they socialised over cups of rakija (plum brandy) and coffee. I had to listen carefully to understand, hearing words like fazer (to do) and lavorar (to work) that sounded more like Portuguese and Italian than modern Spanish. I heard sounds like "dj" [dʒ] in the word, djente (people), “z” [z] in the word roza (rose) and “sh” [ʃ] in the word pasharo (bird) that don’t exist at all in modern European Spanish.

It doesn’t matter where the Sephardic person lives, his homeland is the Judeo-Spanish language

Before they were expelled from Spain, Sephardic Jews already used some Arabic and Hebrew words since they read Hebrew religious texts and many lived under Moorish (Arab) rule. Ladino was also heavily influenced by the different regions of Spain where Jews had lived, “This language that we speak is a mix of the dialects of Spain at that time, before the expulsion,” Kamhi explained.

After the Spanish Jews fled towards the Balkans, the language was further shaped by the regions through which they travelled, adopting words and sounds from Italian, Turkish and other languages to which they were exposed. Today, Ladino holds a profound meaning of cultural belonging and survival for those who still speak it.

In the Spanish documentary El Último Sefardí (The Last Sephardi), Yusuf Altinash, a Sephardic Jew in Istanbul said, “It doesn’t matter where the Sephardic person lives, in Sofia [Bulgaria], in the Adriatic or in Istanbul, his homeland is the Judeo-Spanish language.”

I returned to Sarajevo in 2012 with Prof Bryan Kirschen to film Saved by Language, a documentary about the last four Ladino speakers in Sarajevo: David Kamhi, Ester (Erna) Kaveson Debevec, Jakob Finci and Moris Albahari. As we conversed, I felt like I was in a game of linguistic hopscotch, jumping from my 21st-Century Spanish to their 15th-Century Spanish with leaps into borrowed words from Turkish and other tongues.

“Ladino saved my life in World War Two,” Albahari, a Bosnian Holocaust survivor, told us as we sat together in the Sarajevo Synagogue. In 1941, at age 14, Albahari used Ladino to communicate with an Italian colonel who helped him escape from the train taking Bosnian Jews to Croatia’s Jasenovac concentration camp. Because Ladino, like Spanish, has many similarities with the Italian language, Ladino and Italian speakers can have a basic conversation and understand a great deal.

That wasn’t the only time Albahari used Ladino in World War Two to save his life, he told us. He met a Spanish-speaking Hispanic-American pilot in Drvar, Bosnia and Herzegovina, who thought Albahari was the enemy. “I asked him if he spoke Spanish. He said yes. I spoke to him in Ladino. It was the only way to communicate. I took the pilot and his colleagues to a partisan base in [nearby] Ribnik.”

Ladino was also helpful for Sephardic Jews to communicate with Italian army officers when they were interned in an Italian-controlled camp on an island off the coast of Croatia during World War Two. Kamhi’s parents used the language to speak to Italian army officers at the camp. For Kamhi himself, speaking Ladino made it easier for him to attend school on the island. “Since the two languages [Ladino and Italian] are similar, I soon learned Italian,” he said.

Despite Sephardic musicians such as Yasmin Levy, Sarah Aroeste and Liliana Benveniste performing songs in Ladino around the world, young Sephardic Jews don’t tend to be keen to learn the language. And when the Spanish government announced several years ago that it would allow descendants of Jews expelled during the Inquisition to apply for Spanish citizenship, young Sephardic Jews have begun opting to learn modern Spanish over the language of their ancestors.

“The new generation doesn’t speak Ladino, they speak modern Spanish,” Albahari said.

Now in their 70s and 80s, Sarajevo’s last four Ladino speakers lament that the use of the language in the city will likely end with them. For them, Ladino uniquely represents their histories and identities and reminds them of their family intimacy. “I began to speak in this language,” Kamhi said. “It was the language I used when I wanted to say something to my mother so others wouldn’t understand.”

Today, the only place to hear Ladino in Sarajevo is within the walls of its synagogue where cantor Igor Kožemjakin now leads the congregation, and those who wish to join them, in reciting some Shabbat prayers in the language – as opposed to Biblical Hebrew or Bosnian – as the synagogue’s cantors have done for generations.

“I don’t know what will be the future of this language in Sarajevo or in the Sephardic world,” Albahari said. “But this language is a treasure. It’s a memory. It’s life. And it’s necessary to preserve it.”

Visit the synagogue Visitors can tour the Sarajevo's Ashkenazi Synagogue from 10:00-14:00, Monday to Friday (entry fee: 2KM). Friday night Shabbat services start at sunset and are open to the public. The service is usually led by cantor Igor Kožemjakin and includes some prayers and songs in Ladino.

CORRECTION: A previous version of this article stated that David Kamhi is the current cantor at Sarajevo's Ashkenazi Synagogue. He was replaced in 2017 by Igor Kožemjakin. We regret the error.

Join more than three million BBC Travel fans by liking us on Facebook, or follow us on Twitter and Instagram.

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 and Travel, delivered to your inbox every Friday.