Court backs doctor in penis amputation case