In the summer of 1944, hundreds of royals gathered for the opening of Umaid Bhawan Palace, a magnificent sandstone edifice that dominates the skyline in India's northwestern city of Jodhpur. It was the last of its kind.

Three years later, India was free from British colonial rule, and more than 500 princely states — the semi-sovereign principalities ruled by royal clans — faced an uncertain future. Most have faded into obscurity, but the family that built this palace continues to thrive — in part by converting a section of it into a hotel.

"How many places do you know in the world where you can actually live right where the maharaja is living next door to you?" said the hotel's general manager, Mehrnawaz Avari. "The idea is to treat our guests like kings and queens."

The 347-room palace, considered one of the world's fanciest residences, was used as the primary location for "Viceroy House," a film by director Gurinder Chadha being released Friday in India. The movie details the last days of the British Empire in India and the bloody partition with what became Pakistan in 1947.

The iconic structure in this west Rajasthani city known for its traditional handicrafts was named after Maharaja Umaid Singh, the last king of what was known as the Marwar-Rathore Dynasty. He commissioned the project in 1929 with a "spirit of grandness," said royal family associate Karni Singh Jasol. "He had a larger-than-life vision."

After independence, most of India's princely states opted to join the democratic republic, and initially maintained their titles, property and a degree of autonomy. Within decades, the royals lost almost all of it, though. India amended its constitution in 1971, giving its citizens equal rights and canceling royal privileges, including the regular payments royal families received from the state.

Stripped of their allowances and unsure how to survive as commoners, many royal families descended into chaos. Some held onto property, only to lose it amid internal bickering over rival claims.

"The properties that they inherited were in a true sense white elephants," Jasol said. "The royal families were high on assets, but low on liquidity. They didn't have large bank balances to turn their family properties into something grand or sustain it for the future."

The Singhs of Jodhpur not only maintained their holdings, but managed over decades to grow.

The last reigning maharaja's grandson, Gaj Singh, was only 4 when his father died in a plane crash in 1952, making him sole owner of the palace and other family properties, including the ancestral Mehrangarh Fort.

When royal allowances were canceled in 1971, the young Singh patriarch acted quickly. The family opened part of its palace as a hotel in 1978, and turned the fort into a museum, investing profits into preserving Jodhpur's royal antiquities.

"They today serve as the main economic levers for the city," said Jasol, who is director of the fort and museum.

The palace is open to visitors year-round, and has become a go-to destination for government leaders, other royals, and Hollywood and Bollywood stars alike. In 2007, British actress Elizabeth Hurley married Indian businessman Arun Nayar beneath the white marble canopy, or baradari, on the palace lawn; they have since divorced.

The palace is divided into a home for Gaj Singh and his family, and a heritage hotel of 64 rooms and suites run by the luxury hotel chain Taj Group since 2005. Designed by British architect Henry Vaughan Lanchester, the palace features elements of the art deco style popular in Europe and America in the '30s and '40s, combined with traditional Indian craftsmanship.

Colonnaded verandas guide one's eye up to intricately carved pillars, stylized sculptures and finally a massive central dome topped by a 30-meter (105-foot) golden cupola.

The cost of the royal experience ranges from $500 to more than $12,000 a night. For those who can afford it, the hotel pulls out all the stops.

Visitors are greeted by a smiling guard wearing one of Jodhpur's famous handlebar moustaches; he opens the door while hotel staff shower guests with rose petals. Peacocks roam the palace lawns. Further inside, pulsating Rajasthani folk tunes fill the air as colorful dancers move in choreographed circles. Guests mingle amid crystal chandeliers and silk-draped furniture.

Gold-leaf furniture and ornate mirrors are arranged around gleaming marble floors, while the walls are decorated with family portraits, as well as leopard skins and the busts of other animals hunted by former royals. The decoration was done over three years by Polish artist Stefan Norblin, who had fled from war-torn Europe in 1944. He also painted frescoes and murals in the royal suites.

The royal family has long focused on conserving the region's heritage as a way to utilize its enormous real estate holdings. It manages trusts engaged in water conservation, education and cultural revival projects, creating employment for thousands of locals.

"I know at one time, royalty was a bad word," said Singh's daughter, 42-year-old Shivranjani Rajye. "Now you don't have to shy away from it."

The Cambridge-educated Rajye runs most of the family's business operations, though the family heir is her brother, Shivraj Singh, who also lives with his family in the palace. He has kept a low profile since spending several months in a coma after a near-fatal accident playing polo in 2005.

Jodhpur's residents still see the family as their royals, and Gaj Singh as their maharaja. And he "very much believes he is the king," said Rajye, elegantly dressed in a chiffon sari with a hint of jewelry.

"He never gave up his title — he doesn't have it officially, but he knew who he was, and he knew he commanded respect of the people."

___

Follow Vineeta Deepak at www.twitter.com/VineetaDeepak.