Pakistani officials say 40 people were killed and at least 40 others wounded in fierce sectarian clashes in a remote northwestern town .