If you had six months to live and A$700,000 ($906,460) to spend, you might well splurge it on overseas trips, gifts and charitable donations.
A Sydney man did just that - and was locked up for a month in a psychiatric hospital.
The New South Wales Supreme Court heard that the man, identified only as J, was detained in the Prince of Wales Hospital because his wife, friends and doctors believed he was spending his life insurance payment and superannuation unwisely.
He was discharged only after appealing to the Supreme Court, which ruled he was being detained illegally.
J, 62, was diagnosed with terminal pancreatic cancer in May last year, and received the payout soon afterwards.
He started spending the money, giving gifts to friends, donating to charity and travelling to Eastern Europe to visit his son.
He also gave money to women in Thailand, believed to be ex-girlfriends, and paid for family and friends to fly to Australia to attend his mother's 90th birthday party.
This uncharacteristic extravagance alarmed his third wife, who "might be expected to inherit", the court judgment noted.
Doctors agreed, citing his profligacy as reason to keep him in hospital. They also refused to let his lawyers see him in private.
After J was confined last August, he appealed to the Mental Health Tribunal, which - after a hearing described by his barrister, John Bartos, as "very short and perfunctory" - ruled that he should be detained for the whole of September.
That decision was manifestly inadequate, according to Justice Richard White. In his judgment, which has only just come to light, Justice White said concerns about J's spending could have been addressed by a court order to take over his financial affairs.
Mr Bartos described the case as most unusual. He told the Herald: "J's wife was concerned that he was spending the money too freely or giving it away. In fact, he was not spending huge amounts of money."
"It seems quite an extraordinary situation that on that basis you keep someone locked up in a hospital ... especially when you've got only a couple of months to live."
J died in a hospice in December, by which time he had made peace with his family.