A study of high energy emission from the TeV blazar Mrk 501 during multiwavelength observations in 1996