A California appeals court has upheld a San Diego city ordinance that closes a picturesque children's beach for nearly half the year so that seals may give birth, nurse and wean their pups.

In a decision filed Thursday, the 4th District Court of Appeal reversed a lower court ruling that set aside the ordinance governing Children's Pool Beach in La Jolla, an affluent seaside community in San Diego.

Thursday's ruling will allow for the beach to continue to be closed between Dec. 15 and May 15 every year. Violators face misdemeanor penalties of up to $1,000 in fines or six months in jail.

The Children's Pool is an artificial cove that was used as a swimming hole for youngsters until seals began moving in during the 1990s — spurring a yearslong feud between supporters of the animals and those who want beach access.

In 2014, the City Council approved closing the beach for part of the year after concluding that other efforts to protect the seals during their breeding season haven't worked. The California Coastal Commission issued a permit allowing that action.

Visitors to the area often walk up to the seals, pose for selfies with them and mimic the barking noise they make. When they're disturbed, seals can abandon their pups, give birth prematurely or miscarry, or become frightened and accidentally stampede babies. They've also nipped at humans.

The group Friends of the Children's Pool sued San Diego and the coastal commission, arguing that the Marine Mammal Protection Act and California Coastal Act give the federal government jurisdiction over marine mammals, not local governments. The group won a trial court ruling in the matter.

The appeals court rejected the group's argument and the lower court's ruling, saying nothing in the protection act pre-empts a state's ability to regulate access to its own property.