The Interior Ministry said the attack in Puli Khumri, the capital of Baghlan province, began at noon with a suicide car bomber striking the entrance to the compound and eight gunmen rushing in after the explosion. It said 13 police were killed and another 55 people, including 20 civilians, were wounded before the attackers were all killed.
A police official who was inside the compound during the attack said the insurgents all wore suicide vests and that three of them detonated their payloads, while the other five were shot and killed. The official spoke on condition of anonymity because he was not authorized to brief reporters.
Kalil Narmgo, a doctor at the main hospital in Puli Khumri, said more than 50 wounded people, both military and civilians, had been brought in, including "several" in critical condition.
The Taliban claimed the attack, the latest in an unrelenting wave of assaults on security forces. The insurgents effectively control nearly half the country, and have maintained their tempo of attacks despite holding several rounds of peace talks with the United States in recent months.
In the capital, Kabul, a lawmaker was wounded and his wife was killed in a shooting attack late Saturday.
Police said Sunday it was unclear if the shooting inside Mohammad Afzal Shamil's home was due to a personal dispute or a targeted attack. Shamil is a member of the upper house of parliament representing northeastern Takhar province.
In the western Herat province, a roadside bomb killed three children and wounded another two on Saturday, according to Jelani Farhad, a spokesman for the provincial governor. No one claimed responsibility, but the Taliban often plant bombs on the main roads to target government officials or security forces. The bombs often kill civilians.
In a separate development, Pakistan says Prime Minister Imran Khan and Afghan President Ashraf Ghani spoke by phone to discuss efforts to end the conflict.
"The Prime Minister underlined that Pakistan will spare no effort to advance the common objectives of building peace in Afghanistan and having a fruitful bilateral relationship between the two brotherly countries," the Pakistani government statement said.
Afghanistan and the United States have long accused Pakistan of harboring militants, and many of the Taliban's top leaders are believed to be based there. Pakistan says it uses its limited influence over the insurgents to encourage peace efforts.
The statement said Khan "reiterated his invitation to President Ashraf Ghani to visit Pakistan for a comprehensive exchange of views on all issues of mutual interest."
The Afghan government said in a statement that Ghani accepted the invitation, but that a date has not yet been fixed.