Objective To evaluate the effect of intensive geriatric rehabilitation on demented patients with hip fracture. Design Preplanned subanalysis of randomised intervention study. Settting Jyväskylä Central Hospital, Finland. Participants 243 independently living patients aged 65 years or older admitted to hospital with hip fracture. Intervention After surgery patients in the intervention group (n = 120) were referred to the geriatric ward whereas those in the control group were discharged to local hospitals. Main outcome measures Length of hospital stay, mortality, and place of residence three months and one year after surgery for hip fracture. Results The median length of hospital stay of hip fracture patients with moderate dementia (mini mental state examination score 12-17) was 47 days in the intervention group (n = 24) and 147 days in the control group (n = 12, P = 0.04). The corresponding figures for patients with mild dementia (score 18-23) were 29 days in the intervention group (n = 35) and 46.5 days in the control group (n = 42, P = 0.002). Three months after the operation, in the intervention group 91% (32) of the patients with mild dementia and 63% (15) of the patients with moderate dementia were living independently. In the control group, the corresponding figures were 67% (28) and 17% (2). There were no significant differences in mortality or in the lengths of hospital stay of severely demented patients and patients with normal mini mental state examination scores. Conclusions Hip fracture patients with mild or moderate dementia can often return to the community if they are provided with active geriatric rehabilitation.