Armed men stormed a police station in the southern Pakistani city of Karachi on Friday, killing two people in a hail of gunfire and a series of loud explosions before they themselves were killed.
Security forces retook the building after several hours and killed three militants, a government spokesman said.
Police commandoes and a bomb disposal squad entered the building and a security sweep was under way.
Two people had been killed and 11 wounded in the militants' attack, a government spokesman said.
A huge explosion was heard inside the station after a series of blasts when it was first attacked.
The Pakistani Taliban, or Tehreek-e-Taliban Pakistan (TTP), took responsibility for the attack in a message sent by their spokesman to journalists.
The station houses offices of the city's most senior police. Deputy Inspector General Irfan Baloch told Reuters there could have been up to 30 policemen at the station at the time of the attack.
The TTP, separate from the Taliban ruling neighbouring Afghanistan, has recently increased attacks on police in the northwest of Pakistan as part of its campaign against the government in Islamabad.
Overseas cricket players are competing in the Pakistan Super League, and Karachi is one of the host cities.
There is a game scheduled for Saturday. The police station is located along the route to the stadium and the players' hotel is a few kilometres away.
Police sealed off traffic on the main thoroughfare through Karachi and heavy contingents of security forces, including paramilitary soldiers, had arrived at the scene.

                                
                                        
            Saudi Crown Prince bin Salman to visit Trump in White House
        
            Man charged with 10 counts of attempted murder after knife attack on UK train
        
            Tanzania's Hassan sworn into office after deadly election violence
        
            Powerful 6.3 quake kills at least 20 in Afghanistan, hundreds injured
        
            Turkey set to call for action on Gaza as soon as possible, source says
        
            Hamas hands over three more hostage bodies
        
            India federal agency freezes Anil Ambani Group's $853 million properties
        
            Israeli strike kills one in Gaza as sides trade blame for truce violations
        
                                    