Four gunmen attacked the Pakistani stock exchange in Karachi, killing two guards and a policeman and wounding seven others before being shot dead.
The assailants launched a grenade attack at the main gate to the building and opened fire but police say they failed to make it to the trading floor.
Staff inside took refuge in locked rooms and many were evacuated. Security forces are searching the area.
Militants from the Baloch Liberation Army say they were behind the attack.
Ethnic Baloch groups have fought a long-running insurgency for a separate homeland and a greater share of resources in Pakistan’s Balochistan province.
Pakistan has suffered years of militant violence, mostly by Islamist groups, but attacks such as this one have become rare in recent years.
Monday’s attack began when the militants armed with automatic rifles threw a grenade and then began firing at a security post outside the stock exchange.
“The attackers came in a silver Corolla and were stopped by police at the gate outside where the exchange of fire took place,” Sindh police additional inspector general Ghulam Nabi Memon told BBC Urdu.
Guards fought back, killing all four heavily armed attackers, the authorities say. Three police officials are among the seven wounded receiving treatment in hospital.
Mr Memon said the attackers did not manage to enter the main building and grenades, explosives and other weapons were recovered from them. The Pakistan Stock Exchange confirmed that no militants made it into the building.
Its director, Abid Ali Habib, said the gunmen made their way from the car park and “opened fire on everyone”.
Images from the scene show the bodies of at least two men on the ground next to large amounts of ammunition and weapons. It was not immediately clear if more assailants were involved, prompting an extensive search of the premises by security forces.
Reports say most people at the stock exchange managed to escape or hide in locked rooms. Those inside the building were evacuated from the back door, Geo TV reported.
Trading continued without interruption.
“We locked ourselves in our offices,” Asad Javed, an employee at a brokerage in the building, told Reuters news agency.
The stock exchange has offices for hundreds of financial institutions and is situated in a high security zone along with head offices of banks and other businesses.
The exchange says it has up to 8,000 people working there on a normal day but numbers were down because of home working during the coronavirus pandemic.
The Baloch Liberation Army (BLA) is one of half a dozen armed resistance groups in Balochistan and has launched previous attacks in Pakistan.
In 2018 its members tried to storm the Chinese consulate in Karachi, killing at least four people. All staff inside the building were unharmed.
Last year the BLA attacked a five-star hotel in the port city of Gwadar in Balochistan. The hotel is the centrepiece of a multi-billion-dollar Chinese project and was selected in order to target Chinese and other investors.
Separatist militants in Balochistan oppose Chinese investment, saying it is of little benefit to local people.
The BLA originally sought political autonomy for the province but has gradually evolved into a violent armed separatist movement and is listed as a terrorist organisation by Pakistan, the UK and the US. Widescale abuses and repression by the Pakistani military have been documented over decades in the province, which is difficult to access by journalists and human rights groups.
Balochistan is a sparsely populated region, and the BLA and other militants have sanctuaries there and in adjoining areas in Pakistan. They also are believed to have hideouts in south-eastern Afghanistan.
The province remains Pakistan’s most impoverished area despite being rich in gas and coal reserves, as well as copper and gold. Baloch nationalists have long accused the central government of exploitation, and denying the province its due rights.