LOS ANGELES — The City Council on Wednesday voted to legalize urban beekeeping, overturning a ban dating to 1879 and overriding concerns that it might bring aggressive Africanized hives to backyards.

“To bee or not to bee, that is the question. But there is no question. We must have bees,” Councilman Paul Koretz said before the unanimous vote.

Once the ordinance is signed by the mayor, the nation’s second-largest city will join New York, San Francisco and others that permit beekeeping within their borders.

The city has many hives already – some illegal and some wild. Some estimates put the number of wild hives at 10 per square mile.

Feral hives that are discovered in public areas usually are wiped out because of worries that they might contain Africanized bees – hybrids of tamer European honeybees and a hardier but more aggressive strain.

However, those who work with them say honeybees typically only attack in defense of their hives – a view shared in a recent city report.

The new ordinance restricts beekeeping to backyards of single-family homes, sets buffer zones and requires beekeepers to keep a water source for the hives.

The hobbyists also must register with the Los Angeles County Agricultural Commission.