A direct approach to the synthesis of indolizidine and quinolizidine scaffolds of iminosugars is described. The presented strategy is based on a one-pot sugar lactam reduction with Schwartz’s reagent followed by a diastereoselective Mannich/Michael tandem reaction of the resulting sugar imine with Danishefsky’s diene. The stereochemical course of the investigated reaction has been explained in detail