The numerical solution of boundary value problemsusing boundary integral equations demands the accurate computationof the integral of the kernels, which occur as the nearly singularintegrals when the collocation point is close to the element ofintegration but not on the element in boundary element method(BEM). Such integrals are difficult to compute by standardquadrature procedures, since the integrand varies very rapidlywithin the integration interval, more rapidly the closer thecollocation point is to the integration element. Practice showsthat we can even obtain the results of superconvergence for thecomputed point far enough from the boundary; however, usingstandard quadrature procedures, which neglect the pathologicalbehavior of the integrand as the computed point approaches theintegration element, will lead to a degeneracy of accuracy of thesolution, even no accuracy, which is the so-called ``boundarylayer effect''. To avoid the ``boundary layer effect'', the accuratecomputation of the nearly singular boundary integrals would bemore crucial to some of the engineering problems, such as thecrack-like and thin or shell-like structure problems.The importance of the accurate evaluation of nearlysingular integrals is considered to be next to the singularboundary integrals in BEM, and great attentions have beenattracted and many numerical techniques have been proposed for itin recent years. These developed methods can be divided on thewhole into two categories: ``indirct algorithms'' and ``directalgorithms'', which have obtained varying degree of success, butthe problem of the nearly singular integrals has not beencompletely resolved so far. In this paper, a new efficienttransformation is proposed based on a new idea of transformationwith variables. The proposed transformation can remove the nearlysingularity efficiently by smoothing out the rapid variations ofthe integrand of nearly singular integrals, and improve theaccuracy of numerical results of nearly singular integrals greatlywithout increasing the computational effort. Numerical examples ofpotential problem with their satisfactory results in both curvedand straight elements are presented, showing encouragingly thehigh efficiency and stability of the suggested approach, even whenthe internal point is very close to the boundary. The suggestedalgorithm is general and can be applied to other problems in BEM.