George Osborne said counter-terrorism funding would be increased by 30% in the wake of the Paris atrocities - but failed to rule out cuts to frontline police numbers.
The Chancellor said he has now finalised deals with all Whitehall spending departments ahead of setting out what is expected to be a harsh squeeze on budgets in the spending review on Wednesday.
That includes the Home Office, where Theresa May had been in last-ditch negotiations over reductions that a succession of senior police officers warned would leave Britain unable to deal with a major terrorist assault.
Mr Osborne said it was right that the police should be forced to bear their share of deficit-reduction measures as he repeatedly declined to offer any assurance that officer numbers would not be hit.
But he said he was "absolutely confident" the security services would have sufficient resources to keep the population safe if Islamic State launched a gun and bomb attack in this country.
"Precisely because we are making difficult decisions in other parts of our budget, we can give our military more kit, we can increase our counter terrorism budget by 30% and we can also take action to prevent guns coming into this country and deal with gunmen on the streets," he told BBC1's Andrew Marr Show.
Asked specifically to rule out cuts to frontline policing, he said: "Every public service has to make sure it is spending money well, but we will make sure Britain is properly defended against the terrorist threat.
"You cannot have national security without economic security.
"If your budget is out of control, if you are spending money you don't have, then you can't keep the country safe whether on the streets of Britain or indeed in the Middle East."
He went on: "We made savings in the police budget in the last parliament and actually the number of neighbourhood police officers went up, the proportion of police officers on the front line went up.
"Increasing the counter-terrorism budget by 30% involves money going to the police as well as our security agencies to make sure we can deal with marauding gun attacks, make sure we can stop the guns coming into the country in the first place.
"Of course the threat is omnipresent but I am absolutely confident we are going to have the resources to deal with it."
Mr Osborne played down reports of bitter rows within the cabinet over the depth of cuts to non-protected departments - including a reported threat to resign by Work and Pensions Secretary Iain Duncan Smith - insisting deals had been reached "amicably".
He hinted that his target of running a £10 billion surplus by 2020 could be revised down as he deals with worse than expected borrowing figures.
Shadow chancellor John McDonnell said any cuts to frontline policing "undermine our security".