Introduction: Working on quality and safety in nursing home and homecare services is difficult. Ever-increasing demands from an ageing population and political pressure to keep patients at home are among the challenges facing nursing homes and homecare. There is less knowledge of patient safety risks and adverse events in primary care than in specialised healthcare. Aim: This thesis explores the role of managers in quality and safety work in nursing homes and homecare services. Moreover, the thesis designs, implements, and evaluates a leadership intervention in nursing homes and homecare services to support managers’ quality and safety work. Methods: This study was designed as a two-phase longitudinal multiple case study consisting of design and pilot testing; and implementation and evaluation of the SAFE LEAD intervention. The intervention is based on a leadership guide and includes several workshops and learning activities facilitated by researchers. In phase 1, the intervention was designed with researchers, co-researchers and managers from two nursing homes and one homecare service. The pilot test of the leadership intervention was conducted in one nursing home and one homecare service. Data collection consisted of focus group interviews and observation of managers. Phase 2 started by exploring quality and safety challenges as perceived by managers and employees in two nursing homes and two homecare services prior to participation in the leadership intervention. The study then continued with a longitudinal study of the implementation and evaluation of the leadership intervention and its influence on managers quality and safety work. Data collection in phase 2 included focus group interviews, observations, workshops and site visits with managers and employees. Data analyses in phases 1 and 2 included deductive content analysis and interweaving of observation and interview data. Results: The results describe all activities from development to evaluation of a leadership intervention and its influence on managers’ quality and safety improvement work in nursing homes and homecare services. Paper I detailed the involvement of stakeholders and demonstrated how a participatory approach was important for adaptations of a leadership guide to nursing home and homecare contexts. An intervention that managers could use in their work practice was developed and pilot tested in one nursing home and one homecare service. A key finding in Paper I is the role of context and the need to tailor intervention material (web and booklet) to the context and to the needs, time constraints, language, and interests of managers. Paper II explored managers’ and employees’ perceptions of quality and safety challenges in two nursing homes and two homecare services before the intervention took place. Managers and employees found that quality and safety challenges depended on several factors and implied multiple trade-offs. Managers struggled with external change processes, budget cuts that affected common understanding of and commitment to quality and safety improvement at managerial and staff levels. Paper III showed that the intervention workshops and leadership guide contributed to a common understanding and commitment to quality and safety in the management teams. The leadership intervention influenced managers’ work practice in different ways depending on capacity and needs in the organisations. The leadership guide and the workshops created a social and reflexive arena for quality and safety work in which managers could focus on these topics. Moreover, it provided the managers with a tool for clearer sense of quality and safety work in different settings. Managers found it important that someone established a structure and took responsibility for scheduling and organising quality meetings. However, management continuity and the establishment of structures were crucial for the intervention to be adopted. Conclusion: The longitudinal insight in this thesis broadens the understanding of contextual impact on quality and safety work in nursing homes and homecare services and showed the comprehensive work with translating knowledge into practice. The thesis demonstrates the importance of participatory approach and involvement of stakeholders when designing a leadership intervention. Managers and employees perceived interrelated quality and safety challenges and found context work to be time consuming to make quality and safety improvement common efforts in the organisations. The leadership intervention created a place for reflection for managers and brought a more structured process and commitment to organisational quality and safety work.