Montenegrin police chief Zoran Brdjanin said in a video statement shared with media that attacker was a 34-year-old man he identified only by his initials, V.B.
Brdjanin said the man used a hunting rifle to first shoot to death two children ages 8 and 11 and their mother, who lived as tenants in the attacker's house in Cetinje's Medovina neighbourhood.
The shooter then walked into the street and randomly shot 13 more people, seven of them fatally, the chief said.
"At the moment, it is unclear what provoked V.B. to commit this atrocious act," Brdjanin said.
Andrijana Nastic, the prosecutor coordinating the crime scene investigation, told journalists that the gunman was killed by a passerby and that a police officer was among the wounded. She said nine of those killed died at the scene and two died at a hospital where they were taken for surgery.
Cetinje, the seat of Montenegro's former royal government, is 36 kilometres (22 miles) west of Podogrica, the current capital of the small Balkan nation.
Prime Minister Dritan Abazovic wrote on his Telegram channel that the incident was "an unprecedented tragedy" and urged the nation "to be, in their thoughts, with the families of the innocent victims, their relatives, friends and all the people of Cetinje."