Image copyright AP Image caption Thousands turned up to pray at a shrine for Tama

A lavish funeral has been held for a Japanese cat which became an international star when she was made a station master in western Japan.

Tama, which was made a railway official eight years ago, was credited with putting the rail firm back on track financially after drawing in thousands of tourists.

Her custom-made cap and jacket made her a familiar sight at Kishi station.

The 16-year-old cat died of heart failure on 22 June.

Dozens of company officials and thousands of fans turned out for Tama's Shinto-style funeral on Sunday, where she was elevated to the status of a goddess.

The Shinto religion, practised by many in Japan, has a variety of gods including animals.

Image copyright AFP Image caption Tama, once a stray cat, was given cat food in lieu of a salary

During the ceremony, officials thanked the feline celebrity for saving the station by attracting tourists from around the world.

The president of Wakayama Electric Railway, Mitsunobu Kojima, also gave her the special title of "honorary permanent stationmaster", AP reports.

He said Tama had contributed an estimated 1.1 billion yen ($8.9m; £5.7m) to the local economy.

"She was affectionate with people and hard-working," one local resident said.

Outside the station, bouquets of flowers, cans of tuna and other gifts were left by many of Tama's thousands of fans.

Since 2007, Tama has been quietly welcoming and sending off railway travellers at the station in Wakayama Prefecture.

At the time, the local railway line was almost bankrupt and the station was unmanned but Tama's celebrity status helped to bring the company back from the brink of financial ruin.

The governor of Wakayama Prefecture, Yoshinobu Nisaka, said it was important the practice of using feline staff at the railway station was maintained.

Another cat, called Nitama, has since become an apprentice station master.