Years ago, when her sister was diagnosed with ovarian cancer, Mahire Turk sought divine intervention.

She trekked to a shrine atop a hill overlooking the Bosporus, sat under an ornate dome close to the grave of a Sufi master who died nearly 400 years ago and prayed intensely for her sister to beat the disease.

After chemotherapy, her sister was declared cancer free — and is now expecting a baby, said Ms. Turk, 40, who works in a pharmaceutical warehouse.

So to this day, when worries cloud her mind, Ms. Turk, like many of her compatriots in this ancient, sprawling city of 16 million, visits one of its many shrines to long-dead religious figures to seek a spiritual boost.

“These are the protectors of Istanbul,” Ms. Turk said during a return pilgrimage to the shrine of Aziz Mahmud Hudayi, where she had prayed for her sister. “I am sure that if I pay them a visit, they will protect me, too.”

Centuries of civilization have left Istanbul dotted with such graves. More than just historical relics, many are well-kept, living sites that receive crowds of visitors seeking quiet places to pray, make wishes and unburden themselves from the woes of the modern metropolis.

The shrines combine Islamic devotion, Turkish history and Istanbul folklore. The city’s sailors, for example, have traditionally viewed Aziz Mahmud Hudayi and three other men buried near the Bosporus, which flows through Istanbul, as the waterway’s protectors.

Some of the shrines mark the resting places of documented historical figures. Others are of more dubious historicity, which does not diminish their role in the spiritual life of the city, a role that endures largely unaffected by Turkey’s contemporary political and economic gyrations.

Turkey’s religious authorities have posted signs at some sites to remind visitors that Islam forbids praying to anyone but God. But many of the faithful still seek the intercession of the interred to help them land jobs, buy cars, get healthy, find spouses or have children. And some express a deep affinity for the dead.

“I love him,” Fatma Akyol, a university student in theology, said of Yahya Efendi, a 16th-century Sufi scholar and poet who now rests in a shrine on the southwestern bank of the Bosporus. “I visit him very often.”

Yahya Efendi’s tomb sits under a pistachio-colored dome in an airy room surrounded by the graves of 10 others, including his mother, wife and son. The complex has separate prayer facilities for men and women, both with commanding views of the Bosporus. Outside, stone paths wind through a graveyard shaded by towering trees to a terrace where visitors take photos.

One recent afternoon, cats dozed in the mausoleum’s marble entryway as visitors drank from a stone fountain and removed their shoes before entering to pray. Parents brought their children. A mosque preacher with a long beard said he had brought his wife and her sister “to receive spiritual health.” A teenager in a Metallica T-shirt emerged from the mausoleum, retrieved his shoes and wandered off.

Ms. Akyol said she often spent hours praying and reading scriptures in the shrine. She shrugged off warnings about seeking help from the dead, comparing it to working a connection to get a job.

“When you ask for something from God, those who are beloved by God can be a go-between,” she said.

The shrine of Aziz Mahmud Hudayi sits on the waterway’s opposite bank.

Visitors come to pray near his grave, often returning to distribute sweets after their prayers have been answered, as they do at many shrines.

Outside, teachers told girls from an Islamic summer school to keep quiet during their visit. A brother and sister from a Turkish Black Sea town said they each were seeking “a benevolent affair,” meaning they hoped to get married. And a retired man said the buried mystic had walked on water across the Bosporus, proving his spiritual prowess.

Omer Arik, the vice president of the foundation that oversees the site, told a different version of the mystic’s story, in which the mystic guided a boatman across the water during a storm, using a route that is still named for him. It didn’t bother Mr. Arik that some visitors believed a more miraculous, water-walking version, he said, citing a Turkish proverb: “The sheikh doesn’t fly. The follower makes him fly.”

Near the northern end of the Bosporus’s western bank sits the shrine of Telli Baba, or the Father of the Threads, a figure whose story is imbued with so much lore that even the retired sailor who oversees the shrine doesn’t claim to know his exact history, or even his full identity.

He might have served in the sultan’s army during the conquest of Constantinople by the Ottoman army in 1453. He might have carried in his turban a length of silvery thread that brides traditionally braided into their hair as a sign of his devotion to the Almighty (probably the source of his nickname).

His grave, in a small room with hanging lamps, is covered with silver threads. Visitors cut a piece when they make a wish and are supposed to return it after it comes true.

Hatice Aydin, a retired teacher who cleans the shrine and feeds the local cats, said a minority of visitors wished for children and new jobs.

“Most of them are looking for husbands,” she said.

Sure enough, a preschool teacher soon emerged from the shrine and revealed that she had been asking for a groom. It was her third visit.

Later, a young woman appeared at the entrance in a blue hoop dress that was too large to fit in the stairwell that led to the grave. Her uncle said he had prayed there for her to get married and so had brought her back on her engagement day. They snapped photos near the entrance and left.

Fatma Yilmaz, a financial manager, came bearing wishes for herself and a number of others, she said. She cut 13 pieces of thread: four for her, five for her sister, one each for her son and her ex-husband, and two for friends.

“Now it is on them,” she said. “If their wishes are accepted, they have to come here.”

Atop a hill on the opposite bank stands the fourth of the Bosporus’s protectors, a shrine to Hazreti Yusa, or the prophet Joshua, who is revered by Christians, Jews and Muslims.

A sign from the local religious authorities stops short of claiming that he is actually buried there, noting instead that the site has held religious significance for many centuries. The site is centered on a grave — a more than 50-foot-long raised flower bed. It may be that long because those who built it may not have known exactly where the body was buried and wanted to make sure it was covered.

One recent evening, Rumeysa Koc, 35, stood by the grave, her palms raised. She had come to Istanbul with a colleague to buy merchandise for her women’s clothing line but had woken that morning after a terrible nightmare. The women had finished their work early and decided to squeeze in a shrine visit.

As they drove toward the shrine, she said, she had received a call telling her that the very thing she had dreamed about — she declined to provide specifics — had not come to pass.

“Without even setting foot on this hill, God solved the issue for me,” Ms. Koc said.

So at the grave she had given thanks, she said, and left feeling that her day had been miraculous.

“I am feeling free as a bird,” she said.