Image copyright Rex Features Image caption The band [pictured in January] performed a version of the song The Way Old Friends Do, from their 1980 album Super Trouper

The four members of Abba have appeared together in Sweden, and surprised fans with an impromptu singalong.

The stars gathered on Sunday at a private party to celebrate the 50-year partnership between songwriters Bjorn Ulvaeus and Benny Andersson.

During the gala, Agnetha Faltskog and Anni-Frid Lyngstad performed the Abba song The Way Old Friends Do.

Ulvaeus and Andersson joined in at the end of the song, marking the band's first public performance in 30 years.

Footage of the performance has yet to surface, but images of the quartet have appeared on social media.

Since winning the Eurovision Song Contest in 1974, Abba have sold almost 400 million singles and albums around the world. Mamma Mia!, the musical based on their hits and produced by Ulvaeus and Andersson, has been seen by more than 50 million people.

During their most successful period, the band survived marriage break-ups between Ulvaeus and Faltskog, and Lyngstad and Andersson, but they finally called it a day in 1983.

Their last public performance came three years later, on the Swedish version of TV show This Is Your Life, which was honouring their manager Stig Anderson.

Media playback is unsupported on your device Media caption Abba's members previously reunited at a restaurant opening in Stockholm earlier this year

Abba have resisted pressure to reunite ever since, including a reported $1bn (£689m) offer for the band to tour in 2000.

"They were talking about 120 gigs or something," Andersson said of the deal. "It would have taken 10 years out of my life. Just the stress. And leaving people disappointed all the time.

"It was easy to say no to it. And we all felt the same."

Speaking to the BBC in 2013, Faltskog said she preferred to leave the band in the past.

"It was such a long time ago, and we are getting older, and we have our different lives," she explained.

However, the band have appeared together for promotional events - at the premiere of Mamma Mia! in 2005 and, more recently, at the opening of an Abba-themed restaurant in Sweden.

Speaking after Sunday's celebration, Lyngstad told Swedish newspaper Expressen: "It was absolutely amazing. A lot of emotions.

"We've made this journey throughout our history. Benny and Bjorn in particular. Its been very nostalgic."

An earlier version of this story mistakenly identified the song Abba performed as Me and I, based on Swedish media reports. The first line of The Way Old Friends Do is "You and I".