Wasn't the internet invented for the military?
Yes, the ARPANet. Then it was made public as a feature of no restrictions to spreading media, of course, if it doesn't go against law.
The military information network used to be part of the internet, but due to potential compromise by hacking (and after actually having been hacked a few times) the military cut off all their ties with the internet. Now they have their own network cut off from outside compromise attempts by the best firewall there is: thin air.
So technically, the internet is a by-product of the military, rejected for it's friendry.