AMMAN, Jordan — Astride century-old tracks that cut through the modern metropolis of Amman, a historic train blared a horn to announce its departure. That sound spurred families bearing bags of food, pots of coffee, coolers of soda, grills, hookahs and lots of children into action, scrambling up iron ladders to settle into the train’s wooden cars.
But the party had already begun in car No. 9, where a group of women and dozens of children were clapping along to an Arabic pop song blasting from a battery-powered speaker with flashing disco lights.
The train blew its horn again and lurched to life, jolting the partyers, who laughed as they righted themselves and burst into applause at the sight of the world outside their windows slipping by.
So began a recent trip from Amman, Jordan’s capital, on the last functioning strip of the original Hejaz Railway, the most iconic train in the Middle East.
Built by the Ottomans at the dawn of the 20th century, blown up by Lawrence of Arabia and Arab fighters during World War I, and used as a nostalgic backdrop in “The Mummy Returns” and in syrupy Arabic music videos about forlorn lovers, the railway is a relic of the bygone dream of regional unity before wars, borders and more advanced modes of transportation rendered its services obsolete.
A pet project of Sultan Abdul Hamid II, the railway was completed in 1908 and ran for more than 800 miles through the mountains and deserts of the Levant and Arabia to ferry pilgrims from Damascus to Medina, one of Islam’s holiest cities, now in Saudi Arabia. From there, they would travel on by other means to Mecca, the focus of the pilgrimage.
Secondary lines ran to Haifa — now a major Israeli city — and Beirut, the Lebanese capital on the Mediterranean coast. And plans were in place to connect the line to Constantinople, the Ottoman capital, in the north and all the way to Mecca in the south, stitching together a large swath of the Ottoman Empire.
But only six years after the train’s first triumphant arrival in Medina on Sept. 1, 1908, World War I broke out, leading to the dismemberment of the empire and new borders. The Haifa line went out of service around 1948, when Israel’s creation left it at war with its Arab neighbors. The Beirut line stopped around the start of Lebanon’s 15-year civil war in 1975.
Now, the narrow-gauge tracks remain, but the railway’s mainline crosses three countries — Syria, Jordan and Saudi Arabia — whose leaders have shown little interest in reviving the project.
Saudi Arabia welcomes pilgrims bound for Mecca at a fancy airport terminal and shuttles them around the holy sites on a modern high-speed train. Rail traffic in Syria screeched to a halt after the outbreak of its civil war in 2011.
That leaves only Jordan, which now offers 50-mile leisure trips from Amman to the Al Jizah station south of town and back, with a four-hour lunch break in the middle.
It is a trip that does not go anywhere anyone needs to be, so the riders come for the journey — and a big dose of nostalgia.
“I love trains because they remind me of Agatha Christie novels,” said Islam Dawoud, 36, sinking into her red plush chair and gazing out the window.
She first rode the train as a schoolgirl, she said. There was no air-conditioning and the cars were dusty, but the memory stuck with her nevertheless.
“What I loved was that the window was open and I could put my head out,” she said.
The train departs in the morning from the Amman station, a handsome, ivy-draped stone building from the first decade of the 20th century.
In the train yard were two original, but refurbished passenger cars, including the one that Abdullah I, the great-grandfather of Jordan’s current king, rode into the city in 1921, when he became the territory’s ruler.
Parked nearby were seven giant black steam engines with red wheels. They all still work, but are used only on special occasions because they take hours to fire up and are heavy polluters, said Nader Malkawi, a railway official and train conductor who organizes the trips.
On its recent journey, the train was pulled by two diesel-electric locomotives built in 1976. Some components of the cars were original, but most were Japanese tanker cars that Jordan had converted to wooden passenger cars in 2005.
That upgrade also added electricity for lighting, as well air-conditioning and the speakers that piped Arabic pop music into the cars throughout the trip.
Railway buffs in Jordan also have another option: A line that carried phosphates to Aqaba, Jordan’s only coastal city, stopped running in 2018, Mr. Malkawi said. But that line passes though Jordan’s scenic Wadi Rum, where tourists can take short rides on it and sometimes watch a band of locals on horseback and dressed in period costumes re-enact Bedouin attacks.
The trips from Amman are longer, but without the theatrics. Tickets cost $7 for riders 12 and over, and less for children. Those under 3 ride free. The train has a snack car as well as a V.I.P. car with plush seats, burgundy curtains and a crown on the door.
The trip was different three decades ago, said one passenger, Fidaa Abu Safia, 38, who first rode along the same tracks when she was 6.
There was no music, the wooden seats were uncomfortable and it was hot, she said, but the train still felt magical. She recalled passing trees with yellow blossoms that fell into the windows.
“It was the best trip of my life,” Ms. Abu Safia said.
As the upgraded train wound through the cinder block sprawl of southern Amman, there were no blossoms to see. Instead, many industrial warehouses, junkyards and mechanic shops popped into view, along with a gargantuan failed shopping mall and lots of garbage strewn along the tracks.
The railway lacks crossing guards to stop traffic; the police are supposed to do it. But they were not in evidence that day, so the conductor slowed down when approaching intersections and leaned on the horn as cars and motorcycles raced across until the last instant.
There has also been a problem with boys throwing stones at the train to shatter its windows.
To stop them, railway workers had tried to distract them by throwing candy, Mr. Malkawi said, but it did not work. So they took the boys’ pictures and gave them to the police, who summoned their parents to sign vows that their children would no longer target the train. That tactic worked, mostly.
The dearth of scenic vistas did not bother Hussam al-Khatib, a soldier, who had learned of the trip on Facebook and brought his wife and their three sons. All were first-time train riders.
He said that Jordan did not have great public transportation and that the views were not stellar, but he felt it was important for Jordanians to know their country.
“We are proud of Jordan’s sights,” he said.
Outside Amman, the landscape opened up, with golden wheat fields, greenhouses full of tomatoes and eggplants, flocks of sheep, the occasional herd of camels and barking dogs chasing the train.
Before the station in Al Jizah, where the passengers stopped for lunch, the train passed Amman’s international airport, from which jets took off overhead, roaring reminders of the technologies that had reduced the train from a cutting-edge conveyance to a historical curiosity.
At the station, as workers moved the engines from one end of the train to the other for the return trip, families claimed shady spots under cypress and eucalyptus trees and fired up charcoal grills and hookahs while their children ran around a sandy playground and climbed on abandoned boxcars.
Later, the train blew its horn and the riders returned, snapping photographs alongside the cars.
The return trip was quieter, with the sun, the creaking cars and the steady click-clack of the train lulling many of the children, and some of the adults, to sleep.
But Heba al-Shishan refused to miss any of it. Smiling and snapping photographs as she took in the landscape, she, too, recalled a childhood journey. On that ride, the train had to stop because nomads had tethered sheep to the tracks and had to move them before the trip could proceed.
“These are experiences I will never forget,” Ms. al-Shishan said.