Objective: we analysed outcome after hip fracture with respect to gender and cognitive function. Design: population-based, prospective cohort study. Setting: four university hospitals in Stockholm, Sweden. Subjects: a total of 2,134 consecutive patients admitted with hip fracture during 2003. Methods: gender differences in residence, walking ability and activity of daily living (ADL) were analysed at baseline, after 4 and 24 months in patients with and without intact cognitive function. Results: women were older, more often living alone and had poorer walking ability (P < 0.001). Cognitive dysfunction was equally common by gender. Women were more often treated with a prosthesis (P < 0.001) and sent to rehabilitation (P < 0.001). In the cognitive dysfunction group, men had more co-morbidity (P < 0.001) and total loss of walking ability (P = 0.03), but more often resided in own homes (P = 0.03). There was no gender difference in ADL. Conclusion: men had a higher risk for loss of walking ability and death only in patients with cognitive dysfunction. Cognitive function was the most important factor for returning to own home and regain pre-fracture function.