The PSNI said two masked men entered a house on Margaret Street at about 8 45 pm on Tuesday and fired shots at two other men who were in the house.
A 58-year-old man was unharmed while another, aged 30, was injured in the foot.
Detective Inspector Michael Winters said it was only by “sheer luck” that the situation was not worse.
“One of the masked men, armed with what has been described as a handgun, shot at the man aged in his fifties who was in the kitchen.
“Fortunately he wasn’t physically injured,” he said.
“However, as the 30-year-old occupant attempted to flee, he was shot at and sustained an injury to his foot, for which he is receiving medical treatment for in hospital.”
Police said there were two other men and a woman in the house at the time of the attack.
The gunman is described as being of medium to heavy build while the second suspect is described as being thinner.
Det Insp Winters added: “There is absolutely no justification for this type of brutality.”
Parish priest Fr Michael Canny said it is fortunate that no one was killed in the gun attack.He told BBC News NI it was a very serious attack that can have no justification.
“No matter what issues are at the root of this attack, in any right thinking society, we cannot have people taking the law into their own hands,” he said.
“People cannot act as judge and executioner, there should be only one law and order and that is the PSNI.”
SDLP councillor Martin Reilly described the shooting as “a horrific attack”.
“This type of violence is not wanted anywhere in the city and region,” he said.
“It is very worrying that we have these types of incidents happening across our city.
“Margaret Street is a close knit community, just around the corner from where this attack took place is a children’s play park, it’s a built-up terraced house environment.”