TORONTO - Ontario's highest court has ruled in favour of Canada Post in a dispute which saw the City of Hamilton go up against the Crown corporation over the placement of community mailboxes.

The legal battle was closely watched by municipalities across the country as the case dealt with just how much of a say local governments could have over where the controversial mailboxes could be installed.

Hamilton brought in a bylaw last year after city residents raised complaints about safety, privacy, litter and traffic when the community mailboxes were installed in what they considered less-than-ideal locations.

The bylaw required Canada Post to obtain a $200 permit per site to install boxes on municipal land. City staff would assess each mailbox's location to ensure it met city standards before granting the permit.

Canada Post ignored the bylaw -- saying it infringed on federal rules that grant it final say over the location of mail receptacles -- and the issue ended up in court, where last June an Ontario judge found the bylaw did not apply to the Crown corporation.

The city appealed that ruling but the Ontario Court of Appeal ruled on Wednesday that the bylaw conflicts with federal legislation, which takes precedence.