It is understood that 47-year-old Alan Williamson, who was found dead in a flat in Glenure Loan, Clermiston, was imprisoned for six years and put on the sex offenders register for trying to rape a woman in Uphall, West Lothian.
Officers were called to the flat at half-past midnight on Christmas Day, where they found his body.
They said a 37-year-old woman had been arrested and charged in connection with the man’s death.
It is understood the victim died after being stabbed and that the woman who was arrested was born a man.
Police officers and forensics remained at the scene throughout the day as they searched a ground-floor flat.
Glenure Loan residents, who awoke to find white-suited forensic officers flooding their street on Christmas morning, have told of their shock.
Police officers stood guard on the building for most of the day.
Mother-of-one Samantha Meldrum, 22, who lives across the road from the scene, said: “When I got up I looked out the window and there were four police cars outside. Soon after we saw some forensic officers in white suits heading into the stair. No one knew what had happened but you just knew it was something bad. Later on we heard that a guy had died. I couldn’t believe it on Christmas Day of all days.”
Throughout the day people laden with presents passed the address on the way to visit nearby family and friends.
Another local resident, Deborah Moncrieff, 50, told how she passed by the scene at 4.30am.
She said: “I was coming back from work and there was a police officer outside the door. I didn’t think much of it then but when I got I saw more police cars and knew it was serious.
“It’s horrible to think of something like that happening on the street on Christmas Day.
“Not much happens around here to be honest, there might be the odd thing or two but it’s usually pretty quiet.
“It’s very sad.”
Another local, who asked not to be named, said: “It’s incredible to think that this could happen on Christmas Day.
A police spokesman said: “Local residents will be aware that an area of Glenure Loan has been cordoned off as forensic examinations are ongoing.
“I would like to reassure local people, however, that there is no risk to nearby residents or the general public.
Police confirmed that a 37-year-old woman was expected to appear in court tomorrow in connection with his death.