OTTAWA — The Trudeau government is promising billions of dollars to compensate dairy, egg and poultry farmers affected by Canada's recent free-trade agreements — a move that could play well in vote-rich Quebec and Ontario.

The federal budget is setting aside $2.15 billion over the coming years for supply-managed farmers who lose income because of the country's trade deals with Europe and the Pacific Rim.

Another $1.5 billion is being earmarked to compensate farmers who lose money when they sell their stakes in the three protected domestic markets, which Canada agreed to open up to more foreign competition in each of the agreements.

Supply management in its current form has been around since the 1970s and limits the production of eggs, poultry and dairy in Canada.

The budget does not provide details for how or when the money will be doled out to farmers and producers, who have long railed against any move that would expand foreign involvement in their sectors.

But the promise of compensation could nonetheless salve such opposition and concerns about lost income, particularly in Quebec and Ontario, where many of Canada's supply-managed farmers and producers operate.