Two teenagers arrested in a counter-terrorism operation on Wednesday were apprehended by police just hours after buying two knives.

The boys, both aged 16, were arrested as they walked into a prayer hall on a laneway off Fetherstone Street at Bankstown on Wednesday afternoon.

"Officers seized two knives and the pair remains in custody," a police statement said.

"Police are unable to release anything further at this time however there is no on-going threat in relation to this matter."