A coastal town council has declared a climate and ecological emergency – and vowed to become carbon neutral within six years.