The man shot in the Hamilton suburb of Nawton last night was the victim of a targeted attack, police say.
The group of alleged offenders initially went to the house next door by mistake. The man who lived there opened the door and there was a fight, police said.
He was uninjured, but was shaken by what had happened.
When the offenders went to the house of the man they were targeting, a number of shots were fired and the group fled in cars.
The police are trying to work out if there is any gang connection.