An injured crewman was transported to the beach after a German World War I submarine attack on Orleans on July 21, 1918. Orleans was the only US town to receive enemy gunfire during World War I. Orleans Historical Society/AP

ORLEANS — The 100th anniversary of the only enemy attack on American soil during World War I was commemorated Saturday with a wartime song at an event attended by descendants of a captain from a local lifesaving station.

A German U-156 submarine shelled a tugboat near Orleans on July 21, 1918, the first attack on the US in 100 years. The U-boat sent hits to the tugboat Perth Amboy and its four barges and left an hour later.

Several people were injured, but no one died in the assault or the counter-attack.

The commemoration took place on Nauset Beach. A guitarist led a crowd in singing ‘‘Over There,’’ a wartime song written by George M. Cohan in 1917. Descendants of Captain Robert Pierce, keeper of the Orleans Lifesaving Station during the attack, were present.

The Nauset Sea Scout Ship Explorer Club, under the direction of skipper Dean Skiff, brought out its long surfboat, giving members of the public a chance to see if they could have rowed out to aide in the rescue of the attack survivors.

It remains a mystery why an advanced submarine would attack a target that had no real wartime value. One theory is that the sub had hoped to cut the underwater communications cable that ran from Orleans to France. If that was the case, the mission failed.

The submarine attacked other ships near Canada, but disappeared in September 1918.

More photos:

A crew prepared to receive survivors of a German World War I submarine attack on Orleans, Mass. Orleans Historical Society/AP

Survivors of a German World War I submarine attack arrived in a lifeboat to the shore in Orleans, Mass. Orleans Historical Society/AP

People helped survivors arriving on a lifeboat on the shore after a German World War I submarine attack on Orleans, Mass. Orleans Historical Society/AP