In this sentence,
司令官【しれいかん】は軍刀【ぐんとう】を手【て】にはしたが、すぐに小野田【おのだ】さんに返【かえ】した
The commander took the sword in his hand but immediately returned it to Mr. Onoda.
https://www.yomiuri.co.jp/topics/20240321-OYT8T50062/
What is the grammatical function of はしたが?