He sat as a judge for the last time yesterday in Dunedin, having made his first appearance in the court as a lawyer in 1967.
Mr McElrea (70) said it was a fitting way to end his career, which had been ''a huge privilege with great variety''.
''It's been a wonderful career. My first appearances were in the very same courtroom as I've been sitting in this week.''
Mr McElrea spent 20 years as a full-time judge before becoming an acting warranted judge five and a-half years ago.
He was born in Dunedin and attended Maori Hill School, Otago Boys' High School and the University of Otago, but had been living in Auckland with his wife Margaret.
His two-week posting to the Dunedin District Court coinciding with the end of his career might have been unintentional, he said.
''I was offered these two weeks by the chief judge's assistant and I don't think she knew the significance of Dunedin for me, although she knew I was from the South Island.''
Mr McElrea planned to move to Wanaka with his wife before Christmas. While growing up in Dunedin he spent many holidays in Central Otago.
''It's lovely to be going back. Margaret is a great gardener so she's looking forward to some new plants.''
Mr McElrea's last sitting was acknowledged in court yesterday by senior counsel Anne Stevens.
''There is a happy symmetry that your last sitting is in Otago where you obtained your law degree and masters in philosophy and your father had his practice. We wish you well in retirement,'' she said.