Weapons are very useful and many are patented. One example is Safer and simpler cluster bomb US4744301A
In some parts of the world there is an issue of “ordre public” that can interfere with legal protection for patents on things like gambling machines, devices for deception and, using similar logic, trademarks that are deemed profane.
At one time there was a doctrine in the US that something that facilitated an illegal act wasn’t “morally useful”. So a gambling or suicide machine, etc. were not allowed.
That changed - one turning point was a patent for something that visually simulated a machine that mixed a beverage (juicy whip) in an appetizing way while under the counter making the actual drink in a less customer-preferred way. The heart of the invention was deceiving consumers. It was ruled useful and eventually the prohibition on gambling machines fell also.
Regarding trademarks SCOTUS recently allowed the trademarks “The Slants” for a band of Asian musicians and FUCT for a men’s shirt company.
Back to weapons - nuclear weapons are forbidden from patenting but there is no prohibition in the US for other types of weapons. However, the defense department has representatives stationed in the USPTO who can impose a secrecy order on the prosecution if a patent. You can apply for and prosecute a patent under a secrecy blanket. Maybe someday they will let it free of that restriction and you could get the patent allowed. Now the term of a patent is measured from filing date so a long secrecy order will result in a short or non-existent patent life.
Note that having a patent does not provide any right to make and sell it but just the negative right to try to stop others from making and selling it.
I’m taking your example as an invention of a weapon of primarily war use without any judgement of the specific concept.
The law regarding secrecy orders
37 CFR 5.2 Secrecy order.
(a) When notified by the chief officer of a defense agency that publication or disclosure of the invention by the granting of a patent would be detrimental to the national security, an order that the invention be kept secret will be issued by the Commissioner for Patents.