A friend of Liam Anderson, the son of Angry Anderson who was beaten to death on Sydney’s northern beaches, has been charged with his murder.

Police formally charged Mathew Flame, 20, on Monday afternoon, more than 24 hours after the violent attack at Queenscliff.

Flame was arrested on Sunday morning after emergency services allegedly found him forcefully beating Anderson. Anderson, 26, was found unconscious with serious head injuries by police just after 6am. He was treated at the scene but later died.

It took several officers and the use of pepper spray to restrain Flame, who was eventually taken to Manly police station for questioning before he was charged on Monday.

Flame appeared in person at Manly local court on Monday afternoon and was refused bail.

His lawyer, Charles Waterstreet, said Flame and Liam Anderson were “best friends” and it was a “double tragedy” for the two families.

“What has happened is lightning has struck twice on two individuals and their families,” Waterstreet told reporters outside court on Monday. “It’s a double tragedy for two very, very good families and two very, very good boys.”

When asked how his client was feeling, Waterstreet said: “Everyone is devastated.”

Liam Anderson regularly posted on social media about his alleged attacker, calling him a “brother”.

Detective Inspector Michael Boutouridis described it as a “bloody” attack.

A statement on behalf of Angry Anderson was issued on Sunday afternoon, confirming the death of his son and asking the media and public to respect the family’s privacy.

Friends of the 26-year-old later gathered at the scene to lay flowers and handwritten notes.

Flame is due to reappear at the same court on 29 January.