Let G be a finite group. A subgroup H of G is called an H-subgroup in G if N-G(H) boolean AND H-g <= H for all g is an element of G. A subgroup H of G is called a weakly H-subgroup in G if there exists a normal subgroup K of G such that G = H K and H boolean AND K is an H-subgroup in G. In this paper, we investigate the structure of the finite group G under the assumption that every subgroup of G of prime order or of order 4 is a weakly H-subgroup in G. Our results improve and generalize several recent results in the literature.