The headquarters belongs to the Justice and Development Party, the party of Prime Minister Recep Tayyip Erdogan’s.

There was no immediate claim of responsibility.

Various groups have been blamed for earlier bomb attacks in Turkey, including Kurdish separatists, militants linked to Al Qaeda and shadowy extremist groups from the far left and far right of the political spectrum.

Last September, a bombing attack in central Ankara killed three people and wounded at least 34, the interior minister said at the time, in the first deadly bombing in Turkey’s capital in more than four years.

In May 2011, unidentified attackers in northern Turkey opened fire on a campaign convoy belonging to Mr. Erdogan’s party, killing one police officer and wounding another, local officials said at the time. The attack came after Mr. Erdogan had left the convoy. It was unclear whether he had been the intended target.

In June 2010, a remote-controlled bomb killed 5 people and wounded 15 on a busy highway in Istanbul as a military shuttle bus traveled between a residential compound and offices that include a military police headquarters.