(Health.com) -- People who quit smoking are at high risk of developing type 2 diabetes after they kick the habit, most likely due to post-quitting weight gain, a new study has found.

Experts caution, however, that the benefits of quitting smoking -- including a lower risk of heart attack and lung cancer -- far outweigh the risk of developing diabetes, which can be treated with diet, exercise, and medication.

The study, which was published today in the Annals of Internal Medicine, followed nearly 11,000 middle-aged people without diabetes -- 45 percent of whom were smokers -- over a nine-year period. Compared to those who had never smoked, the people who quit smoking during the study had a 73 percent increased risk of developing type 2 diabetes three years after quitting.

The increased risk was even more dramatic in the years immediately after quitting. "Based on our analysis, [it's] probably 80 percent or even 90 percent," says the study's lead author, Hsin-Chieh (Jessica) Yeh, an assistant professor of internal medicine and epidemiology at the Johns Hopkins University School of Medicine.

By contrast, the smokers who continued to light up were only 31 percent more likely than non-smokers to have developed diabetes at the three-year mark. Previous research has shown that smokers are at higher risk of developing diabetes.

There was some good news in the study: The increased risk of diabetes does not appear to last over the long term. After 12 years without cigarettes, the ex-smokers were at no greater risk for diabetes than the people who had never smoked, the study showed.

In all, 1,254 participants in the study developed type 2 diabetes, a chronic disease in which the body fails to adequately convert blood sugar (glucose) into energy.

The spike in diabetes risk that the researchers observed is most likely due to the extra pounds that many ex-smokers pack on after giving up cigarettes, Yeh and her colleagues note. Weight gain is a major risk factor for type 2 diabetes, and it's also one of the most common side effects of smoking cessation.

The people in the study who quit smoking gained an average of 8.4 pounds, which is in the normal range (most ex-smokers gain about 4 to 10 pounds), and those who gained the most weight showed the greatest risk for developing diabetes. The waistlines of the ex-smokers in the study also grew by an average of 1.25 inches; abdominal fat is another risk factor for diabetes.

To counteract the increased risk of diabetes, people who quit smoking should implement a series of lifestyle changes in consultation with their physicians, Yeh says.

Dr. Richard D. Hurt, director of the Nicotine Dependence Center at the Mayo Clinic in Rochester, Minnesota, recommends that people who quit smoking stick to small portions of low-fat, low-calorie foods. They should also get moving, he adds.

"Even just moderate exercise -- like 30 minutes of brisk walking -- reduces the urges to smoke and reduces withdrawal symptoms," he says. "People are able to distract themselves, it makes them feel better, and it uses up some of the calories."

Nicotine-replacement products may also be helpful, says Hurt, since nicotine is largely responsible for the appetite-suppressing effect of cigarettes. Nicotine patches or gum deliver nicotine much more slowly than a cigarette, however, so to suppress appetite and prevent weight gain they may need to be administered in above-average doses, says Hurt, who was not involved in the new study.

If they are taken for at least three to six months, smoking cessation drugs such as bupropion, an atypical antidepressant sold as Zyban or Wellbutrin, may also limit weight gain, Hurt says.

In addition to recommending lifestyle changes, Yeh and her colleagues also suggest that physicians keep an eye on the blood glucose levels of patients who quit smoking, as elevated glucose levels can be a warning sign for type 2 diabetes. "You should probably do more frequent glucose testing after quitting for early detection," she says.

Despite her study's findings, Yeh is quick to emphasize that quitting smoking -- or better yet, never starting in the first place -- is far healthier than continuing to smoke, which can cause a host of deadly health problems ranging from heart disease to lung cancer.

Dr. Hurt agrees. "Type 2 diabetes is associated with smoking to begin with; this study found there's a 30 percent increased risk if you're a smoker compared to nonsmokers," he points out. "Stopping smoking increases that risk, but it's way offset by the other health gains."