Background: National and international research has repeatedly shown that many late adolescents have poor motivation for school. Moreover, the fact that a considerable proportion of youth do not complete upper secondary education is an insistent challenge with severe costs for the individual and society. This thesis concentrates on upper secondary students’ intentions to quit school, which is considered an indicator of a negative motivational process that can lead to dropout from school. From a motivation theory perspective (self-determination theory, in particular), intentions to quit school is considered a persistence-related academic outcome. A theoretical rationale based on self-determination theory (SDT) and achievement goal theory (AGT) of how and why perceptions of the psychosocial learning environment may contribute to the development of such intentions is proposed. Emanating from this theoretical ground and previous evidence, research questions considering how the following aspects of the psychosocial learning environment are related to intentions to quit school were posed: perceived teacher support (emotional support, autonomy granting, and feedback quality), loneliness among peers, and perceived mastery climate. Thus, while decades of research on school dropout have focused on demographic factors and students’ academic achievement level, the current approach scrutinizes the potential in the learning environment on a process that do not limit itself to the final “pass or fail” (dropout vs. completion) yet acknowledges the broader and gradual process of the individual’s more or less prominent intentions to quit school. Enhanced knowledge regarding this process can be vital from a dropout preventive perspective, but also for increased understanding of how the psychosocial learning environment in upper secondary school is related to student motivation. Aims: The overall aim was to empirically investigate how students’ perceptions of the psychosocial learning environment in upper secondary school are related to their intentions to quit school. Three separate studies had specific aims subordinate to this. Hopefully, knowledge derived from this work can contribute to inform measures to optimize students’ motivation and increase their likelihood of completing upper secondary education. Methodology: The thesis has a quantitative approach, and all three studies were empirical investigations of a sample of 1379 students in upper secondary schools in Rogaland, Norway. The main data source was self-reports from these students on three occasions during upper secondary school: T1 in the second semester of the first year, T2 in the first semester of the second year, and T3 in the second semester of the second year, giving a total timespan of 13 months. In addition to self-reports, register data on students’ previous academic achievement, gender, and study track in upper secondary were obtained from county administration, which were applied as control variables in the structural models. Study I had a cross sectional design, and Study Ⅱ and Study Ⅲ had longitudinal panel designs. To investigate the specific research questions, different statistical methods were applied, primarily types of structural equation modeling (SEM) in Mplus. This included confirmatory factor analyses (CFA), mediation models, multigroup testing of moderation, latent growth curve models (LGCM), and growth mixture models (GMM). Results: In the cross-sectional design of Study Ⅰ, the main aim was to investigate the degree to which three aspects of perceived teacher support (i.e., emotional support, autonomy granting, and feedback quality) were related to intentions to quit school, directly, and/or indirectly via emotional engagement and academic boredom. Relevant individual background variables (gender, prior academic achievement, immigrant background, as well as study track) were accounted for. The SEM results showed that all three aspects of perceived teacher support were indirectly negatively associated with intentions to quit school. In addition, emotional support showed a direct negative association with intentions to quit and thus appeared to be a particularly important aspect of perceived teacher support. In Study Ⅱ, the main aim was to investigate intentions to quit school longitudinally, and specifically scrutinize how individual change in intentions to quit was related to initial levels and changes in perceived emotional support from teachers and loneliness among peers at school. Initially, unconditional latent growth curve models indicated an average increase in intentions to quit school and loneliness among peers during the study period, and no average change in emotional support from teachers. However, substantial individual differences were found in the trajectories of all these three concepts. A multivariate latent growth curve model with the rate of change in intentions to quit as the final outcome showed no significant prediction from initial levels of either emotional support or loneliness; however, a substantial inverse associated change with perceived emotional support from teachers and a strong positive association with change in loneliness among peers was found. In Study Ⅲ, individual change in intentions to quit school was kept as the focal outcome yet investigated from the outset of potential trajectory subgroups of perceived emotional support from teachers. The substantial between-student differences in individual trajectories of perceived emotional support detected in Study Ⅱ served as an important ground for this person-centered approach. Furthermore, change in perceived mastery climate was theorized to function as an intermediate variable in a hypothesized association with change in intentions to quit school. Three distinct trajectory subgroups of perceived emotional support from teachers were identified: stable-high (84.9%; the normative group), decreasing (7.8%), and low-increasing (7.3%). Compared to the normative group, membership in the decreasing emotional support trajectory subgroup was indirectly associated with more increase in intentions to quit, and this association was fully mediated by a more negative development in perceived mastery climate. Membership in the low-increasing group was associated with more positive development in mastery climate, but no significant indirect association with change in intentions to quit was found. Conclusion: Prominent in all three studies, was the central role of perceived emotional support from teachers as negatively associated with students’ intentions to quit school. This was also persistent when accounting for background variables, and predominantly when investigating longitudinal relationships. Students with decreasing trajectories of perceived emotional support during the first and second years of upper secondary school were more likely to have steeper increase in intentions to quit school during this phase. However, the opposite route was not supported and requires further research. In addition to emotional support from teachers, individual trajectories of loneliness among peers were closely related to individual trajectories of intentions to quit school, and these results add to previous research conducted in cross-sectional designs. In sum, the current work contributes to empirical support for psychosocial factors in school having a substantial potential to keep students motivated to continue upper secondary school, and this should be considered in all efforts to enhance late adolescents’ academic motivation and to increase upper secondary completion rates.