South Korea’s lawmakers on Tuesday outlawed the breeding, slaughter and sale of dogs for human consumption, a centuries-old practice that is unpopular and rare today.

Dog meat was once more common, and remained so in the decades after the Korean War when the country was destitute and meat was scarce. It is used in a well-known dish that Koreans call “bosintang,” or “soup good for your body.” But the practice became increasingly shunned as incomes, pet ownership and concern for animal welfare rose steadily in the late 20th century.

Today, many South Koreans, especially younger people, see eating dog meat as appalling. About 93 percent of South Korean adults said they had no intention of consuming dog meat in the future, and 82 percent said they supported a ban, according to a survey conducted last year by Aware, an animal welfare organization in Seoul.

“This is history in the making I never thought I would see in my lifetime,” Chae Jung-ah, the director of Humane Society International Korea, said in a statement by the group. She added, “We reached a tipping point where most Korean citizens reject eating dogs.”

With the ban’s passage, South Korea joined a list of other places that have prohibited the trading of dog meat, including Hong Kong, India, the Philippines, Singapore, Taiwan and Thailand, the group said. Millions of dogs are still killed each year for their meat in places like Cambodia, Indonesia and Vietnam, according to Four Paws, an animal welfare organization in Austria.

President Yoon Suk Yeol’s cabinet is expected to officially put the ban into effect. Mr. Yoon and Kim Keon Hee, the first lady, who own numerous pet dogs and cats, have campaigned for the ban. The president managed to succeed after previous governments had failed to gather enough support to end the practice.

Under the law, which has passed the National Assembly with broad support, a person who butchers dogs for human consumption could face three years in prison or a fine of 30 million South Korean won, or about $23,000, after a three-year grace period. The breeding and selling of the animals could would be punishable by two years in prison or a fine of 20 million won.

The law will also offer financial incentives for dog farmers and owners of restaurants that serve dog meat to switch jobs, requiring each to submit a phaseout plan to a local government.

In 2022, about 520,000 dogs were being raised for human consumption at 1,150 farms, and about 1,600 restaurants were selling dog meat nationwide, according to lawmakers — considerably lower than in years past.

An association of dog farmers protested the bill in the months before it passed, arguing that eating dog meat was a matter of individual choice, and demanding more compensation for farmers who would lose their businesses as a result of a ban.

The law’s passage marked a milestone for animal protection activists who have campaigned for the ban for years. Since 2015, they have helped 18 dog farmers close their operations or transition into vegetable farms. The farmers gave up their animals to be adopted as pets.