The primary role of intercostal muscles lies in the process of respiration. When inhaling, the external intercostal muscles contract, lifting the rib cage and allowing the lungs to expand and fill with air. This action also creates negative pressure within the thoracic cavity. During exhalation, particularly active exhalation, such as during physical exertion, the internal intercostal muscles contract, pulling the rib cage downwards and internally, which helps to expel air from the lungs. Thus, the intercostal muscles ensure that the process of breathing is efficient and effective, enabling oxygen intake and carbon dioxide expulsion.