Hurricane Ernesto may be far from land but the storm still threatens beachgoers on the East Coast of the United States with dangerous swells and rip currents, the National Hurricane Center warned on Sunday.

“Life-threatening surf and rip current conditions are likely” for several days on the East Coast and parts of Canada, the Hurricane Center said, as Ernesto strengthened back to a hurricane after being downgraded to a tropical storm on Saturday.

The storm is expected to pass near Newfoundland, Canada, late on Monday or early on Tuesday but will not approach the United States, the Hurricane Center said.

New York City closed its beaches in Queens and Brooklyn to swimming on Saturday and Sunday because of the dangerous rip currents caused by Ernesto.

The town of Kitty Hawk, N.C., closed beaches to swimming over the weekend and threatened to fine those who ignored the warning. Several beaches in North and South Carolina had red flags raised on Sunday to warn beachgoers that strong rip currents were present.

A 41-year-old man drowned off Surf City, N.C., on Saturday afternoon. Kellie Cannon, a spokeswoman for Surf City’s Emergency Management Office, said the beaches in the area were experiencing dangerous rip currents because of Hurricane Ernesto.

Two other men, ages 65 and 73, drowned hours apart on Friday after being caught in rip currents off the shore of Hilton Head Island, S.C., the Beaufort County Sheriff’s Office said. Their deaths were not tied directly to Ernesto because the area can experience rip currents throughout the year, the authorities said.

Rip currents are fast and powerful channels of water near the beach that can carry swimmers out to sea.

Tens of thousands of people in the United States are rescued from rip currents every year and about 100 die from being caught in them, according to the National Oceanic and Atmospheric Administration.

As of mid-August, 30 people had died in rip currents this year, according to preliminary National Weather Service data.

If you are visiting a public beach and are unsure of how safe it is to swim, look for one of the colored flags raised by local authorities.

Red flags present on the beach generally mean the authorities recommend staying out of the water. If there is a double red flag, that’s a sign that the water is closed to the public because conditions are too dangerous.

If you do get caught in a rip current, do not swim against it to get back to shore, experts say. Swim parallel to the shore until you break out of the rip current, and then head back to shore with the waves at an angle.

Or you can try waving your arms to get the attention of a lifeguard or someone on shore. If you see someone caught in a rip current, don’t attempt to rescue the person yourself. Instead, find a lifeguard or throw a flotation device.