I had a flight from Jeddah that night back to Washington, where I now work as a diplomatic correspondent. If I boarded the train around noon, I could get to Jeddah by midafternoon, have time to walk around the old town and seaside corniche, maybe get dinner and catch my flight.

Booking a ticket was as easy as making a reservation on Amtrak. From my hotel room in a desert canyon in Al Ula, I got on the website of the Haramain High Speed Railway, clicked on the English-language option and looked at the schedule. There was a train departing at noon the next day that would get me into Jeddah at 2:16 p.m. All economy-class tickets were sold out so, using an American credit card, I booked a business-class seat for 220.5 Saudi riyals, or $59.

I’ve always enjoyed train travel, but there was a particular reason this railway intrigued me. When I was Beijing bureau chief, my job at The Times before this one, I researched commercial projects abroad that involved Chinese companies. Chinese state-owned enterprises were getting infrastructure contracts in many countries, even before President Xi Jinping began heavily promoting his Belt and Road Initiative.

I came across the fact that a Chinese state-owned enterprise was involved in the first phase of building a high-speed railway between Medina and Mecca. There was a certain dissonance here: The ruling Communist Party of China, officially atheist and repressive toward many of the country’s Muslims, was helping build a railway connecting the holiest sites in Islam.