Video footage showed smoke coming from the first storey property in Juniper Grove in the Craigshill area of the town.
A fire service spokesperson confirmed they sent three fire engines to the scene at around 6.30pm and that firefighters used a hose reel jet and breathing apparatus to put out the flames. The spokesperson said crews left the scene around 8.20pm.
One local resident, who witnessed the scene unfold, said the man barricaded himself inside the flat before a fire was started in at least one of the rooms inside, with smoke seen pouring out of the windows.
The resident said he also saw the man throwing objects - including parts of his sofa - from a window and shouting abuse at police officers. He reckons this went on for about two hours before police went inside and removed the man.
The resident said that armed police were also in attendance on Saturday night.
Footage from the scene shows an area outside of a block of flats taped off and a number of police officers standing outside.
Police have been contacted for more details.
A message from the Editor:
Thank you for reading this article. We're more reliant on your support than ever as the shift in consumer habits brought about by coronavirus impacts our advertisers.
If you haven't already, please consider supporting our trusted, fact-checked journalism by taking out a digital subscription at https://www.edinburghnews.scotsman.com/subscriptions.