HAVANA — Cuba denounced the American diplomatic mission on the island on Friday for what it called subversive activities designed to undermine the government of Raul Castro, a shot across the bow just four days before the US election.

The Foreign Ministry said the Americans illegally give classes inside the walls of the US Interests Section, which Washington maintains instead of an embassy, and provide Internet service without permission.

It vowed to defend Cuba’s sovereignty ‘‘by any legal means’’ at its disposal, but gave no details.

Advertisement

US officials have long maintained that they are doing nothing illegal in Cuba and that supporting free speech, cultural activities, and Internet access is a common practice at missions around the world.

‘‘We are absolutely guilty of those charges. The US Interests Section in Havana does regularly offer free courses in using the Internet to Cubans who want to sign up. We also have computers available for Cubans to use,’’ State Department spokeswoman Victoria Nuland told reporters in Washington. ‘‘Obviously this wouldn’t be necessary if the Cuban government didn’t restrict access to the Internet and prevent its own citizens from getting technology training.’’