It's actually not one sword, but two swords:
But they said: Lord, behold, here are two swords (μάχαιραι ώδε δύο). And he said to them: It is enough.
Pope Boniface VIII, Unam Sanctam (1302):
We are informed by the texts of the gospels that in this Church and in its power are two swords; namely, the spiritual and the temporal. For when the Apostles say: 'Behold, here are two swords' [Lk 22:38] that is to say, in the Church, since the Apostles were speaking, the Lord did not reply that there were too many, but sufficient. Certainly the one who denies that the temporal sword is in the power of Peter has not listened well to the word of the Lord commanding: 'Put up thy sword into thy scabbard' [Mt 26:52]. Both, therefore, are in the power of the Church, that is to say, the spiritual and the material sword, but the former is to be administered for the Church but the latter by the Church; the former in the hands of the priest; the latter by the hands of kings and soldiers, but at the will and sufferance of the priest.
However, one sword ought to be subordinated to the other and temporal authority, subjected to spiritual power. For since the Apostle said: 'There is no power except from God and the things that are, are ordained of God' [Rom 13:1-2], but they would not be ordained if one sword were not subordinated to the other and if the inferior one, as it were, were not led upwards by the other.
Crean, O.P. & Fimister, Integralism ch. 11 "The Two Swords", § "Relation of the temporal power to the Church within Christendom":
It is customary to speak of the subordination of the temporal to the spiritual power within Christendom as ‘the doctrine of the two swords’. In Holy Scripture, the sword is the symbol both of the civil power to coerce which arises from nature and reason,29 and also of the revealed word of God, cutting away from men all that obstructs the salvation of souls, even the highest of natural ties, to prepare the way for the coming of Christ in grace and glory.30 In one place the apostle compares this word to a double-edged sword, perhaps because it convicts the preacher as well as his flock,31 and in the Apocalypse it comes forth from the mouth of the conquering Messiah. Elsewhere, in words full of mystery, Christ bade His apostles take two swords with them when they went out into the night.32 St Peter Damian, a doctor of the Church who died in 1072, states that these two swords are the kingship and the priesthood. The sword of the priest, he says, must render more gentle that of the king, while the sword of the king must sharpen that of the priest.33
29. Rom. 13:4.
30. Eph. 6:17; Lk. 2:35.
31. Heb. 4:12.
33. Sermon 69, ‘On the consecration of a church’, PL 144: 900. […]
Cornelius à Lapide, S.J., commentating on Mt. 26:51 (that St. Peter "struck the servant of the high priest."):
A question is raised, what was this sword? merely a knife (culter) [for the Paschal sacrifice], or a military sword (ensis), or an ordinary sword (gladius)? The Fathers are in favour of ensis. S. Hilary says that the sword was ordered to be sheathed, because He was about to destroy them with no human sword, but with the word of His mouth (Rev. 1:16, 19:15). S. Ambrose explains the two swords (Luke 22:38) mystically, as the Old and New Testaments, with which we are armed against the wiles of the devil.
But writers on all sides explain these two swords allegorically as the twofold power of the Church, temporal and spiritual (see Extrav. “Unam sanctam” De Majoritate et obedientia). And again by the sword is denoted excommunication, which cuts off a man from the Church.