Background and aim: Achalasia is an esophageal motility disorder of unknown etiology. We aimed to determine achalasia pathogenesis by studying alterations in esophageal smooth muscle contraction and intraluminal environment and the associated inflammatory response in its most common subtype, type II Achalasia. Methods: To determine the level of 20-kDa myosin light chains (LC20) phosphorylation and CPI-17 expression, we analyzed muscular samples of the LES which were obtained from patients with type II achalasia who underwent peroral endoscopic myotomy, using Phos-tag SDS-PAGE. Then, we examined gene expression of Th1, 2, and 17-related cytokine and the proteins associated with contractile function. Additionally, 16S rRNA amplicon sequencing was performed on these samples to analyze the esophageal microbiota. Control mucosal samples of the esophageal body were obtained from 11 asymptomatic patients with early gastric cancer who underwent ESD, and control muscular samples of the LES were obtained from 16 asymptomatic patients with esophageal cancer who underwent surgery. Finally, esophageal conditioned media obtained from patients with type II achalasia were transferred into the mouse esophagus to determine whether the esophageal intraluminal environment is associated with achalasia. Results: Firstly, approximately 30% of LC20 were phosphorylated in the LES from the control group under resting and stimulated conditions, whereas less than 10% of LC20 phosphorylation was detected in achalasia under all conditions. The hypophosphorylation of LC20 in achalasia was associated with the downregulation of the myosin phosphatase-inhibitor protein CPI-17. Secondly, Th17-related cytokines, including IL-17A, IL-17F, IL-22, and IL-23A, were significantly upregulated in mucosal layer of patients with achalasia, while IL-13 was levels were downregulated in the smooth muscle tissues. α-Diversity index of esophageal microbiota and the proportion of several microbes, including Actinomyces and Dialister, was increased in achalasia. Actinomyces levels were positively correlated with IL-23A levels, whereas Dialister levels were positively associated with IL-17A, IL-17F, and IL-22 levels. Last not the least, esophageal IL-17F gene expression levels increased and in mice after oral administration of the conditioned media. In addition, in conditional media transferred mice, the HuC/D staining showed a reduction in myenteric ganglion cells. Conclusions: In the LES of patients with achalasia, hypophosphorylation of LC20, a possible cause of impaired contractility, was associated with CPI-17 downregulation and an increased Th17-related immune response. The esophageal intraluminal environment, including the esophageal microbiota, could be associated with the exacerbation of achalasia at least.