The government will spend hundreds of billions of yen on anti-terrorism and safety measures as part of an extra stimulus budget in the wake of the attack by Islamist militants in Bangladesh that killed seven Japanese, government sources said.

The seven development-aid workers were killed last week in one of the most brazen attacks in the South Asian nation's history.

The spending will be included in the economic stimulus package that could top ¥10 trillion ($98.94 billion) to safeguard Japan's fragile economy in the face of weak demand and a rising yen following Britain's shock vote to exit the European Union.

The sources spoke on condition of anonymity as the plan has not been finalized.

The government and ruling coalition are set to work out the size of stimulus spending and funding sources for the stimulus after Sunday's Upper House election, before compiling the extra budget in the autumn.

Japan approved extra spending on anti-terrorism efforts during the fiscal year that ended on March 31. The spending covered information-gathering abroad and beefed-up security around foreign embassies ahead of the Group of Seven summit in Japan in May.