At least 35 firefighters rushed to tackle the blaze on North Fort Street, which broke out around 6pm on Saturday.
Eight firefighters ran into the building wearing breathing apparatus to rescue the residents inside, before the blaze took hold of the top of the property.
Advertisement
Hide AdAdvertisement
Hide AdFire crews managed to get the fire under control, before it flared up again after a loud bang inside the building, according to eye witnesses.
Investigators are still examining the site to determine the cause of the blaze, which left ten flats badly damaged.
Local resident Alan Pagan said that the fire appeared to start in the roof of the 5-storey building.
He said: "It appeared to start where the gutter is, and spread quite slowly from there.
"Thankfully it didn't spread into the stairway and so the residents were able to get out."