In recent times, there has been a huge increase in the average number of cases of skin cancer per year, which sometimes become life threatening for humans. Early detection of various skin diseases through automated detection techniques plays a crucial role. However, the presence of numerous artefacts makes this task challenging. Dermoscopic images exhibit various variations, including hair artefacts, markers, and ill-defined boundaries. These artefacts make automatic analysis of skin lesion quite a difficult task. To address these issues, it is essential to have an accurate and efficient automated method which will delineate a skin lesion from the rest of the image. Unfortunately, due to the presence of several types of skin artefacts, there is no such thresholding method that can provide a sufficient segmentation result for every type of skin lesion. To overcome this limitation, an ensemble-based method is proposed that selects the optimal thresholding based on an objective function. A group of state-of-the-art different thresholding methods such as Otsu, Kapur, Harris hawk, and grey level are used. The proposed method obtained superior results (dice score = 0.89 with p-value ≤ 0.05) as compared to other state-of-the-art methods (Otsu = 0.79, Kapur = 0.80, Harris hawk = 0.60, grey level = 0.69, active contour model = 0.72). The experiments conducted in this study utilize the ISIC 2016 dataset, which is publicly available and specifically designed for skin-related research. Accurate segmentation will help in the early detection of many skin diseases.