Shinto elders at the centuries-old Unesco World Heritage Site of Shimogamo Shrine upset neighbors when they bulldozed a swath of old Kyoto forest to build an apartment complex with units selling for more than $2 million apiece.

“They should call it the Shimogamo Corporation,” says one angry parishioner, Akira Hitomi.

Skepticism of religion is common enough in Japan that there’s a saying, “If you want to get rich, become a priest.”

In truth, many of the nation’s 180,000 temples and shrines are in deep financial trouble, says Yoshihide Sakurai, a professor of sociology of religion at Hokkaido University. “They need side businesses to make ends meet.”

Many visit Shinto shrines for weddings and New Year’s Day, and Buddhist temples for funerals, but fewer than 40 percent consider themselves religious, according to surveys by public broadcaster NHK. Fewer still are devoted enough to pay for the upkeep of places of worship, many of which are hundreds of years old and made of wood.

To make money, priests have hosted speed-dating events, rap battles, and televised flower-arranging contests. They’ve also turned to real estate, a sign of the times as ultralow interest rates and a new inheritance tax that’s encouraged retirees to shelter money in rental properties have fueled a property boom. Real estate investment last year accounted for about a third of the country’s economic growth.

Location, location, location — it’s the reason consultants and developers, including West Japan Railway Co. and home building giant Sekisui House Ltd., are pitching projects to priests.

Temples and shrines occupy some of the best buildable spaces in the country’s jam-packed cities.

In the central district of Osaka, wrecking balls are busy demolishing an old building Otani Shinshu Buddhists used for weddings and funerals. When construction is finished in 2019, a 17-story business hotel operated by the Excel Tokyu Hotel group will stand beside the temple’s main hall.

In Tokyo, Mitsui Fudosan Co. has so far developed an office tower and two condominiums on land leased from shrines. One is a short walk from the country’s busiest train station.

At Nashinoki Shrine, a 100-year-old Shinto complex right outside the walls of Kyoto’s Imperial Palace, priests in 2012 leased their only available open space. Now the shrine’s approach snakes around the back of a three-story apartment building sandwiched between two towering entry gates.

“It’s not a good look,” says Mieko Okajima, a tourist from Tokyo stopping by to drink from the shrine’s spring.

Nodding to a sign inviting visitors to fill their water bottles for a $2 donation, she says, “It used to be free.”

A priest who was strolling nearby was unapologetic about the suggested donations and said he’d be glad to hear other ideas to keep things going.

Even in Kyoto, where zoning regulations are among the strictest in the country, no laws prevent temples or shrines from building on their grounds.

“As long as they don’t violate construction codes, we can’t stop them,” says Tomoko Uehara, head of Kyoto’s historical preservation division.

For priests who feel uncomfortable with overtly commercial development, builder Sekisui House may have a solution: “pilgrimage lodgings.”

Visitors have long been able to get a taste of the monastic lifestyle by paying the equivalent of a few dollars and volunteering to help with chores in exchange for a night in a bare-bones temple dormitory.

This is not that, explains Sekisui spokesman Masayoshi Kusunoki. “It’s basically a business hotel, but with a traditional Japanese aesthetic,” he says.

Sekisui’s temple hotels, which the company started marketing in April, will be manufactured in blocks on a factory line and can be snapped together on site.

The Hyatt Regency hotel chain has started an upscale version of the idea at five temple locations in Kyoto. A night at one of its bungalows starts at about ¥171,000 ($1,500) per person. No meditation required.

Shimogamo Shrine began its adventures in real estate to get out of a financial pinch, says Hideaki Seo, a planner at the development arm of West Japan Railway, which managed the shrine’s project. For seven centuries, Shimogamo Shrine has performed a radical — and costly — ritual of spiritual renewal, ripping down and rebuilding its giant wooden structures every 21 years. In 2013, the shrine could raise only half the ¥3.43 billion ($30 million) needed.

That’s when the elders began to look to development, and some parishioners started to protest. Hitomi, a property broker himself, says he gathered signatures from more than 8,000 other residents who wanted development stopped, but to no avail. He’s surprised that Shimogamo’s priests, who pack in weddings every 30 minutes on weekends, say they’re broke.

Representatives of the shrine declined to comment.

Once construction is finished in June, visitors to Shimogamo Shrine will enter by a path that runs down the middle of a well-landscaped apartment complex. Two-thirds of the 99 units are already under contract. The average price per square foot rivals some of Tokyo’s most expensive neighborhoods.