The statement came a day after Karzai's spokesman made a similar accusation.
Homayun Hamidzada, Karzai's spokesman, said on Tuesday: "Evidence shows the hallmark of a particular foreign intelligence agency which we believe was behind this attack.".
He, however, refused to name the foreign country or the spy organisation.
Ansari said mobile phones seized from the men involved in the attack showed they had "constant contacts" with bases across the border with Pakistan.
The spokesman said eight of the 16 people arrested over suspected links to the attackers were government employees.
He did not give details, but authorities had earlier said a defence ministry weapons expert and a police nurse were arrested for allegedly facilitating the attack.
Islamabad denies any role in the attack.